TooManyClauses exception during rescore query

Hi, I have a rescore query with a term filter with a ton of clauses (5000 plus). The query kinda looks like this:

 "query":{  
      "function_score":{  
         "query":{  
            "bool":{  
              ...
            }
         },
         "functions":[  
            {  
               "field_value_factor":{  
                  "field":"weight"
               }
            }
         ],
         "score_mode":"multiply"
      }
   },
   "rescore":{  
      "window_size":500,
      "query":{  
         "rescore_query":{  
            "function_score":{  
               "functions":[  
                  ...                  
                  {  
                     "filter":{  
                        "terms":{  
                           "my_id":[  
                              <ALL 5000+ ids>
                           ]
                        }
                     },
                     "weight":1000.0
                  }
               ],
               "score_mode":"multiply",
               "boost_mode":"multiply"
            }
         },
         "query_weight":1.0,
         "score_mode":"multiply",
         "rescore_query_weight":1
      }
   },

We just upgraded from ES 1.7 to ES 5.6.1. Was wondering if why this wasn't causing an issue in ES 1.7. Was the maxClausesCount greater in 1.7 (how much was it ? ) . Is there a way I can change my query to make sure this doesn't happen ? (The rescore query only seems to have a query rescorer. )

Thanks in advance !

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