# JAVA Retrieve multimatch searchterm

**URL:** <https://discuss.elastic.co/t/java-retrieve-multimatch-searchterm/200425>\
**Category:** Elasticsearch\
**Created:** [September 20, 2019, 1:04pm UTC](https://discuss.elastic.co/t/java-retrieve-multimatch-searchterm/200425 "2019-09-20T13:04:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NsrWissam](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@NsrWissam](https://discuss.elastic.co/u/NsrWissam)\
**Post date:** [September 20, 2019, 1:04pm UTC](https://discuss.elastic.co/t/java-retrieve-multimatch-searchterm/200425/1 "2019-09-20T13:04:15Z")

</div>

**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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 11, 2019, 9:08am UTC](https://discuss.elastic.co/t/java-retrieve-multimatch-searchterm/200425/2 "2019-10-11T09:08:18Z")

</div>

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