Avoiding max clause count

Hello. I am in the process of migrating my team's Elasticsearch 2.4 clusters to Elasticsearch 5.
I am changing the DSL to satisfy the breaking changes in ES 5. Most of our searches were unscored by using filter. Can I write my query such that it is un-scored and will avoid the max_clause_count.
Es 2.4 Query:

    {
         "query": {
            "filtered": {
               "filter": {
                  "bool": {
                     "must": [{
                           "term": {
                              "_document.$type": "securitySettings"
                           }
                        }, {
                           "bool": {
                              "should": [{
                                    "terms": {
                                       "_linkIds.sectionIds": ["RR3EF4k", "RR3dIWo", Thousands of ids...]
                                    }
                                 }, {
                                    "terms": {
                                       "_linkIds.sectionIds": ["RR3ECt2"]
                                    }
                                 }
                              ]
                           }
                        }
                     ]
                  }
               }
            }
         }
    }

I changed it to this, but now realize this is scored and is not what we want.

  {
         "query": {
            "bool": {
               "must": [{
                     "term": {
                        "_document.$type": "securitySettings"
                     }
                  }, {
                     "bool": {
                        "should": [{
                              "terms": {
                                 "_linkIds.sectionIds": ["RR3EF4k", "RR3dIWo", Thousands of ids...]
                              }
                           }, {
                              "terms": {
                                 "_linkIds.sectionIds": ["RR3ECt2"]
                              }
                           }
                        ]
                     }
                  }
               ]
            }
         }
    }

Thanks for the help.

Edit: I have found Executing Filters: https://www.elastic.co/guide/en/elasticsearch/reference/current/_executing_filters.html
Is that the approach I should take, filter nested in bool with filters within?

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