I'm trying to convert a project to use the latest Elasticsearch 6 and am having this problem. I don't know if the problem is "Product" vs "product". In my mappings and attributes I specify "products", so I am not sure why I get this error when I try to index a product.
Error:
Invalid NEST response built from a unsuccessful low level call on PUT: /products/products/1?pretty=true&error_trace=true
"Rejecting mapping update to [products] as the final mapping would have more than 1 type: [Product, products]"
Request:
{
"id": 1,
"warehouseId": 0,
"productStatus": 1,
"sku": "102377",
"name": "Name",
"shortDescription": "Description",
"longDescription": "Description",
"price": 37.3200
}
My code:
[ElasticsearchType(Name = "products")]
public class Product : BaseEntity
{
[Key]
public int Id { get; set; }
public int WarehouseId { get; set; }
[Display(Name = "Product Status")]
public Enums.ProductStatus ProductStatus { get; set; }
[Required, StringLength(10)]
public string Sku { get; set; }
[Required, StringLength(200)]
public string Name { get; set; }
[StringLength(500), Display(Name = "Short Description")]
public string ShortDescription { get; set; }
[DataType(DataType.MultilineText), Display(Name = "Long Description")]
public string LongDescription { get; set; }
[Column(TypeName ="Money")]
public Nullable<decimal> Price { get; set; }
}
connection.DefaultMappingFor<Product>(m => m.IndexName("products"));