Elasticsearch DSL query for OR condition
The Elasticsearch DSL(Domain Specific Language) query for OR condition. There are times where we often require to fetch the data from the elasticsearch which satisfies either of the one condition (i.e. OR condition). This is not directly provided in the Kibana Discover tab like it is provided for AND condition. To achieve this we require to write the DSL query. Below is the sample query for OR condition
{
"query": {
"bool": {
"should": [
{
"match": {
"type": "App1"
}
},
{
"match": {
"type": "App2"
}
}
],
"minimum_should_match": 1
}
}
}
This means to get the data which has type 'App1' OR 'App2'"query": {
"bool": {
"should": [
{
"match": {
"type": "App1"
}
},
{
"match": {
"type": "App2"
}
}
],
"minimum_should_match": 1
}
}
}
Comments
Post a Comment