Is it possible to perform a complex query in just filter context? In my case scoring does not matter at all. The documentation states that in a bool query filter
and must_not
are performed in a filter context.
So can I wrap a query in filter
parameter and have it include bool
elements that have a should
property? Seems to work, but is this a recommended way?
A simplified case would be: All users that are over the age of 20 AND have glasses AND (are software developers OR data analysts) AND (have a degree in analytics OR engineering)
Here is an example query (completely unrelated to the sentence ^):
GET index/_search
{
"query": {
"bool": {
"filter": [
{
"terms": {
"someField": [
"0",
"1"
]
}
},
{
"terms": {
"someField2": [
"3",
"4",
"0"
]
}
},
{
"match_phrase_prefix": {
"someField3": "Mich"
}
},
{
"bool": {
"should": [
{
"prefix": {
"someField4": "Test"
}
},
{
"prefix": {
"someField5": "Test"
}
}
]
}
},
{
"range": {
"CreationTime": {
"gte": "2019-08-08",
"lte": "2019-10-08"
}
}
}
]
}
}
}
Before I used a bool query with a must
parameter.
Thanks in advance for any help.