elasticsearch query_string和术语搜索语法

Mic*_*rey 3 elasticsearch

我想搜索query_string包含BobIndustry_Type_ID8OR 9.

我得到一个解析错误: Parse Failure [No parser for element [Industry_Type_ID]]

{
    "query" : {
        "query_string":{"query":"Bob"},
        "terms" : {
            "Industry_Type_ID" : [ "8", "9" ],
            "minimum_match" : 1
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我相信我错过了一些明显的东西.

imo*_*tov 7

您可以使用两个子句的bool查询来执行此操作must:

{
    "query" : {
        "bool" : {
            "must" : [
                {
                    "query_string":{"query":"Bob"}
                },
                {
                    "terms" : {
                        "Industry_Type_ID" : [ "8", "9" ],
                        "minimum_match" : 1
                    }
                }
            ]
        }
    }
}
Run Code Online (Sandbox Code Playgroud)