Hi everybody.
Maybe this is a silly doubt but if someone can answer.
I have 3 docs, 1 with status:true field, 1 with status:false field and 1 doc without status field.
POST idx_test/_bulk
{"index":{}}
{"name":"xpto 1", "status": true}
{"index":{}}
{"name":"xpto 2", "status": false}
{"index":{}}
{"name":"xpto 3"}
I want to use a bool-filter to retrieve all 3 documents. I'm in doubt if I should use match_all inside the bool-filter or a should. Which of these two would be the best option looking at performance?
Filter with match all:
GET idx_test/_search
{
"query": {
"bool": {
"filter": [
{
"match_all": {
}
}
]
}
}
}
Filter + should
{
"query": {
"bool": {
"filter": [
{
"bool": {
"minimum_should_match": 1,
"should": [
{
"bool": {
"must_not": [
{
"exists": {
"field": "status"
}
}
]
}
},
{
"term": {
"status": {
"value": false
}
}
},
{
"term": {
"status": {
"value": true
}
}
}
]
}
}
]
}
}
}