JAVA Retrieve multimatch searchterm

Elasticsearch version: 7.3.0

Fresh install or upgraded from other version? Fresh

Java Library: HighLevel

I am trying to retrieve the original searchterm inside a complex query which is wrapped inside a MultiSearchRequest using the Java High Level Rest Client. See the following where Pain is the searchterm:

{
    'query': {
        'bool': {
            'should': [{
                    'term': {
                        'preflabel_sab_lat': {
                            'value': True,
                            'boost': 10
                        }
                    }
                }
            ],
            'filter': [{
                    'terms': {
                        'sab': ['SNOMEDCT_US']
                    }
                }
            ],
            'minimum_should_match': 0,
            'must': [{
                    'function_score': {
                        'boost_mode': 'multiply',
                        'functions': [{
                                'script_score': {
                                    'script': {
                                        'source': "3e-6*doc['rank'].value*doc['rank'].value"
                                    }
                                }
                            }
                        ],
                        'query': {
                            'multi_match': {
                                'type': 'most_fields',
                                'query': 'Pain',
                                'fuzziness': 'auto',
                                'fields': ['label', 'label.raw^5', 'label.lat', 'label.3gram^0.1']
                            }
                        }
                    }
                }
            ]
        }
    }
}

In the end a MultiSearchResponse is returned and from this object I can only get the individual SearchResponses and the results contained within these responses, but not the searchterms related to the multimatch that formed the individual searchRequest.

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