Scenario
We have below 2 indexes
-> index1 has field HOST
-> index2 has 2 fields HOST & HOST.raw
Requirement:
I want to perform aggregate query on HOST such that for index1 it should consider field HOST and for index2 it should consider field HOST.raw
Basically if HOST.raw is present then consider it else take HOST
Presently we are using below query which considers only HOST field.(not HOST.raw if available in index)
"aggregations" : {
"HOST" : {
"terms" : {
"field" : "HOST",
"size" : 500,
"order" : {
"_count" : "asc"
}
}
}
}
Is there any way I can accomodate my requirement by modifying query ?