在 Elasticsearch 5.6 中使用以下映射:
"category" => [
"type"=>"keyword",
"doc_values"=>true,
"index"=>false
"store"=>true
]
我得到的建议是,由于其 doc_values 设置,可以编写一个对该字段进行过滤的查询,即使 index 属性设置为 false,但似乎 doc_values 字段仅对聚合和排序有用。
是否可以创建一个查询来过滤该字段?
最佳答案
未编入索引的字段是 by definition ,不可搜索。 Elasticsearch 不会将其放入倒排索引(用于搜索)。如果您尝试运行搜索查询,您将收到类似 Cannot search on field [category] since it is not indexed.
的错误消息。
关于elasticsearch - 是否可以在 Elasticsearch 中使用 doc_values=true 过滤非索引字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46983843/