Is there any way to apply multiple conditions to the post_filter in elasticsearch?
GET /job/_search
{
"post_filter":
{
"terms": {
"expertise_level": [
"medium",
"high"
]
}
},
"aggs": {
"expertise_level": {
"terms": {
"field": "expertise_level",
"size": 10
}
}
}
}
This will work. But I want to add multiple filters to the query. How can I achieve this??
</div>
Use bool
clause:
{
"post_filter": {
"bool": {
"must": [
{
//Add Filter 1
},
{
//Add Filter 2
},
{
//Add Filter 3
}
]
}
}
}
Try
{
"post_filter": {
"and": {
"filters": [
{
"terms": {
"FIELD": [
"VALUE1",
"VALUE2"
]
}},
{
"terms": {
"FIELD": [
"VALUE1",
"VALUE2"
]
}
}
]
}
}
}