我正在尝试通过标签在Elasticsearch中搜索文档,并根据标签的权重对其进行排名。我为此使用Elasticsearch Rank Feature Query。
文档可以具有任意标签,基本上可以是任何英语单词。我声明了rank_feature
类型的地图字段,它可以工作。因此,我的文档中有这样的内容:
{
"_source": {
"rank_feature_tags": {
"cat": 100,
"dog": 20,
"wildlife": 70
}
}
}
在此字段的索引映射中,我将其声明为rank_features,如下所示:
"properties" : {
"rank_feature_tags" : {
"type" : "rank_features"
}
}
似乎新地图中的每个标签都正在成为Elasticsearch索引中的新字段,例如rank_feature_tags.dog
,rank_deature_tag.cat
,rank_feature_tags.wildlife
等。
我一直在添加文档,并且标签的数量也在不断增长(因此,索引中的字段数量也在增长)。当我到达接近1000个标签时,使用新标签为文档建立索引时,我开始出现以下错误:
Elasticsearch exception [type=illegal_argument_exception, reason=Limit of total fields [1000] in index [my-index] has been exceeded]
。
如何阻止这些字段添加到ES索引中,同时仍然可以将Rank Feature Query
与该地图中的权重标签一起使用?