0

I have a pre-existing ES 7.x queries which use both should and filter/must clauses together like so for example

"query": {
"bool": {
  "should": [
     ....
   ] 
  "must": [
    ....
  ]
}

},

And these queries return data because because by default minimum_should_match param is set to 1. However, I know since Elastic 7x there's a breaking change and when should clause is used in conjunction with either must/filter then minimum_should_match parameter is set to 0 so should clause doesn't get applied by default (see see this response and elastic doc). That's a massive breaking change!! It will be a huge change for me to add minimum_should_match = 1 in every query I use should so I wonder whether there's some global setting I could use to default my ElasticSearch's the parameter minimum_should_match = 1 whenever should is used?

george
  • 3,102
  • 5
  • 34
  • 51
  • Unfortunately, it's not possible to set the value of `minimum_should_match` globally. How do you build your queries? respectively do you store them somewhere? – Val Jun 15 '21 at 12:50
  • some queries are static but most are dynamically build – george Jun 15 '21 at 12:51
  • 2
    Then even better, whenever you add a `should` clause in your application logic, you can just add `minimum_should_match` as well, easy peasy. – Val Jun 15 '21 at 12:53
  • good suggestion but it will require code changes so I was hoping I could run some query against my ES cluster to default minimum_should_match to 1 regardless. this looks like a massive breaking change! – george Jun 15 '21 at 12:56
  • Well, there will always be breaking changes. That's why major releases are for. Since 7.0 came out more than 2 years ago (April 2019), that's plenty of time to prepare for this migration, don't you think? – Val Jun 15 '21 at 13:00
  • well, interestingly enough, I noticed the behaviour changed from ES 7.5+ onwards instead of 7.0. Currently, I've got 7.4x and it works fine and I noticed the difference when I attempted to upgrade to 7.10x. Any ideas why that might be the case? – george Jun 15 '21 at 13:35
  • 1
    For reference, [here is the PR](https://github.com/elastic/elasticsearch/pull/35354) that explains it all. – Val Jun 15 '21 at 14:05
  • I understand it's weird but I noticed the following - the combination bool{'should' + 'filter'} has been working fine till 7.4 but since 7.5 it stopped working fine. bool{'should' + 'must'} stopped working since 7.x though – george Jun 15 '21 at 14:21

0 Answers0