Terms查询
多词条查询允许匹配那些在内容中含有某些词条的文档。词条查询(term)查询允许匹配单个未经分析词条,多次条查询可以用来匹配多个这样的词条。假设interests字段中含有sing或dance的文档。
curl -XGET 'http://localhost:9200/oa/user/_search?pretty=true' -d '{
"query": {
"terms": {
"interests": ["sing", "dance"],
"minimum_match": 1
}
}
}
}'上述查询返回在interests字段中包含一个或两个搜索词条文档。minimum_match属性设置为1,则至少需要一个词条应该匹配。因为只有两个词条关键词,则可以设置minimum_match属性设置为2,来查询匹配所有词条文档。
Last updated
Was this helpful?