Nested Query inner_hits: why do I only get one under a bool's must?


#1

Hi all,

I'm trying to use inner_hits in my bool must query.
The query is conceptually MUST: [NESTED, NESTED]
ie, two separate nested queries must match to score a hit.

I believe I always get the second inner_hits result in my query results, but not the first. It does look like the query hits are matching correctly, just the inner_hits aren't complete.

Any guidance?

I'm using the Python API, so my body looks like this (it's not quite Json, but it almost is):

    {
    'size': 10, 
    'query': {
        'bool': {
            'must': [{
                'nested': {
                    'path': 'attributes', 
                    'score_mode': 
                    'avg', 'inner_hits': {},
                     'query': {'bool': {
                             'must': [{'match': {'attributes.ename': 'n1'}},
                                      {'match': {'attributes.sv': 'v1'}}]}}}}, 
                      {
                 'nested': {
                    'path': 'attributes', 
                    'score_mode': 
                    'avg', 
                    'inner_hits': {},
                    'query': {'bool': {
                            'must': [{'match': {'attributes.ename': 'n2'}},
                                     {'match': {'attributes.sv': 'v2'}}]}}}}]
        }
    }
}

(system) #2

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