Bypassing some queries for some indices

Hi All,

We have one alias defined for our 100 indices. For some indices we want one query to execute and for some others we want some other query

We used _index field for this in following way

{
  "bool": {
    "filter" : {
        "terms":
        { "_index":[ "cr_sc_1" ] }
    },
    "must" : { Complex Query 1} 
    "should" : { Complex Query 1} 
   }
},
{
  "bool": {
    "filter" : {
        "terms":
        { "_index":[ "cr_sc_2" ] }
    },
    "must" : { Complex Query 2} 
    "should" : { Complex Query 2} 
   }
}

For indices which are not in term query we were hoping must and should queries of that block won't be executed.

However when the must and should queries are being executed even for indices which are not in term query. We know this as when we remove must and should queries then it takes much lesser time.

We thought _index field was a way to bypass some queries bases on index. Is there any other way of selectively executing queries on some indices in an efficient manner ?

Thanks

Can you provide some more details about your experiment? Removing the must/should queries will likely affect performance because it's drastically changing what's being executed on each index

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