elasticsearch query_string和术语搜索语法

时间:2012-09-05 19:26:21

标签: elasticsearch

我想搜索包含query_stringBob Industry_Type_ID8的{​​{1}} {/ 1}}。

我收到一个解析错误:9

Parse Failure [No parser for element [Industry_Type_ID]]

我确信我遗漏了一些明显的东西。

1 个答案:

答案 0 :(得分:7)

您可以使用bool query和两个must子句来执行此操作:

{
    "query" : {
        "bool" : {
            "must" : [
                {
                    "query_string":{"query":"Bob"}
                },
                {
                    "terms" : {
                        "Industry_Type_ID" : [ "8", "9" ],
                        "minimum_match" : 1
                    }
                }
            ]
        }
    }
}
相关问题