我的json查询:
{
"size": 3,
"query": {
"filtered": {
"query": { "match_all": {} },
"filter": { "term": { "publication_type": "horse mouth" }}
}
}
}
有谁知道如何在字段publication_type中搜索两个单词“horse口”?
Atm我只能在搜索“马”或“嘴”时得到结果。
使用Elasticsearch 1.1
最佳答案
您可以为此使用terms过滤器。如果您希望所有术语都出现在文档中,则可以使用执行模式来“和”。默认值等于“或”
例:
{
"size": 3,
"query": {
"filtered": {
"query": { "match_all": {} },
"filter": { "terms": { "publication_type": ["horse", "mouth"]}}
}
}
}
关于elasticsearch - 过滤字段中的多个单词字符串(elasticsearch 1.1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26179158/