Kibana DSL 或查询

Kibana DSL or query

我在 Kibana 中有一个名为 test 的字段。如何编写 DSL 查询来查找 test 的值为“一二三”或“四五六”的文档?

您可以使用 bool/should clause with the match_phrase 查询

{
    "query": {
        "bool": {
            "should": [
                {
                    "match_phrase": {
                        "test": "one two three"
                    }
                },
                {
                    "match_phrase": {
                        "test": "four five six"
                    }
                }
            ]
        }
    }
}

或者您可以在 test.keyword 字段中使用 terms query

{
    "query": {
        "terms": {
            "test.keyword": [
                "one two three",
                "four five six"
            ]
        }
    }
}