Rawland Hustle
Rawland Hustle

Reputation: 781

Kibana DSL or query

I have a field in Kibana called test. How can I write a DSL query that finds documents where the value for test is either "one two three" or "four five six"?

Upvotes: 0

Views: 1022

Answers (1)

Bhavya
Bhavya

Reputation: 16172

You can use the bool/should clause with the match_phrase query

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

OR you can use terms query on the test.keyword field

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

Upvotes: 2

Related Questions