Elasticsearch 6:拒绝映射更新,因为最终映射将具有多种类型 [英] Elasticsearch 6: Rejecting mapping update as the final mapping would have more than 1 type
问题描述
我正在尝试将项目转换为使用最新的Elasticsearch 6,并且遇到了这个问题。我不知道问题是产品还是产品。在我的映射和属性中,我指定了产品,因此我不确定为什么在尝试为产品建立索引时会出现此错误。
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.
错误:
无效的NEST响应是由对PUT的不成功的低级调用生成的:
/ products / products / 1?pretty = true& error_trace = true
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]"
请求:
{
"id": 1,
"warehouseId": 0,
"productStatus": 1,
"sku": "102377",
"name": "Name",
"shortDescription": "Description",
"longDescription": "Description",
"price": 37.3200
}
我的代码:
[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"));
推荐答案
这是因为ES 6发生了重大变化。 x:删除了映射(即使为了向后兼容,您仍然可以在路径中指定映射),因此实际上将索引限制为单一类型。
This is because of a breaking change in ES 6.x: mappings were removed (even if for backward compatibility you can still specify it in the path) thus de facto limiting the index to a single type.
请参阅此处以获取更多信息。
这篇关于Elasticsearch 6:拒绝映射更新,因为最终映射将具有多种类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!