MultiIndex query with sort and search filters different for each indices

Hi Team,

Hope you are doing doing good!!!

Can you help me on this???

I need a MutiIndex search query, where I can sort the columns of each Indices and specify the Columns for each Indices(_Source) and with filter condition for each indixes.

Say I have two indices Index1, Index2.
Index1 has columns idIndex1, col1Index1, col2Index1
Index2 has columns idIndex2, col1Index2, col2Index2
GET index1,index2/_search
{
"_source":["col1Index1"]
"aggs": {
"index1,index2": {
"terms": {
"field": "{_index}"
}
}
},
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"match": {
"idindex1": "1"
}
}
],
"filter": [
{
"terms": {
"_index": [
"index1"
]
}
}
]
}
},
{
"bool": {
"must": [
{
"match": {
"idindex2": "2"
}
}
],
"filter": [
{
"terms": {
"_index": [
"index2"
]
}
}
]
}
}

  ]
}

}
}

Here this query is applying to both the indices with same output columns.

where do I add the Sort and _Source??

Please help me on this...

Thank you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.