How to combine many queries together in query
? Simply use bool
boolean with must
{
"query: {
"bool": {
"must": [
{ <query 1> },
{ <query 2> }
]
}
}
}
What about filter
? There are 2 ways:
# use filter: [ array of filters ]
{
"query: {
"bool": {
"must": [
{ <query 1> },
{ <query 2> }
],
"filter": [
{ <filter_1> },
{ <filter_2> }
]
}
}
}
OR using bool
with must
:
{
"query: {
"bool": {
"must": [
{ <query 1> },
{ <query 2> }
],
"filter": {
"bool": {
"must": [
{ <filter_1> },
{ <filter_2> }
]
}
}
}
}
}