Help needed in refactoring Elasticsearch Query

I am trying to refactor a elasticsearch query from written for 2.4 (it's a very old one) and want to make it compatible for elasticsearch 7.5

Here is my structured query:

{
'query': {
    'filtered': {
        'filter': {}, 
        'query': {
            'bool': {
                'must': [
                    {
                        'bool': {
                            'should': []
                        }
                    }
                ]
            }
       }
    }
}, 
'_source': {'exclude': []}, 'size': 0}

I have gone through the stackoverflow for alternative of filtered clause since it has been deprecated in new version. Most of the solutions on the internet are related to replacing filtered followed by filter clause to bool followed by filter clause.

In this case, I have filtered followed by query also. How should refactor the whole query in clean format ?

It would be great if anyone can help me with this, thanks! :slight_smile:

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