Elasticsearch 6: Rejecting mapping update as the final mapping would have more than 1 type


Elasticsearch 6: Rejecting mapping update as the final mapping would have more than 1 type



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"));




2 Answers
2



I deleted the index and recreated it and it appears to be fine now. I think when I first created the index I didn't have the correct attribute name so that might explain the error I was getting.



Prior to elasticsearch v6, an index can have only 1 mapping by default. In previous version 5.x, multiple mapping was possible for an index. Though you may change this default setting by updating index setting "index.mapping.single_type": false .


"index.mapping.single_type": false



In your case, my assumption is you had already created the index with mapping Product. That is why it was rejecting new mapping in your second request with "product" (p in small case).


Product






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

how to run turtle graphics in Colaboratory

Export result set on Dbeaver to CSV