# Possible to query if two texts match via the \_analyze APIs?

**URL:** <https://discuss.elastic.co/t/possible-to-query-if-two-texts-match-via-the-analyze-apis/136954>\
**Category:** Elasticsearch\
**Created:** [June 22, 2018, 12:59am UTC](https://discuss.elastic.co/t/possible-to-query-if-two-texts-match-via-the-analyze-apis/136954 "2018-06-22T00:59:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NewHere](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@NewHere](https://discuss.elastic.co/u/NewHere)\
**Post date:** [June 22, 2018, 12:59am UTC](https://discuss.elastic.co/t/possible-to-query-if-two-texts-match-via-the-analyze-apis/136954/1 "2018-06-22T00:59:54Z")

</div>

Hi I have some custom analysers in my index, I want to test if two input texts are considered a match using one or some or any of these analysers via the \_analyze APIs.

e.g. doing a POST to host/\_analyze with `{"analyzer": "my_custom_analyser", "text": "elasticsearch"}` would give me all the analysed tokens from the input text "elasticsearch" with "my\_custom\_analyser". At the moment I will have to run through the returned tokens to do a string equality test in my code for the other text I would like to test, in order to check if they match. I wonder if there is a convenient API that takes two input texts and return a simple true/false result, for example `{"analyzer": "my_custom_analyser", "analyse_text": "elasticsearch", "search_text": "elastic"}` would return true/false if "elasticsearch" and "elastic" is a match or not after analysed by "my\_custom\_analyser".

Better yet if I can simply issue `{"analyzers": ["my_custom_analyser1", "my_custom_analyser2"], "analyse_text": "elasticsearch", "search_text": "elastic"}`, the API would return `{"my_custom_analyser1": true, "my_custom_analyser2": false}` (i.e. to test with multiple analysers all at once without issuing multiple API calls.

Is the \_analyze APIs capable to do all these (now)?

---

<div class="post-metadata">

**Author:** ![johtani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johtani/32/44956_2.png) [@johtani](https://discuss.elastic.co/u/johtani)\
**Post date:** [June 22, 2018, 7:23am UTC](https://discuss.elastic.co/t/possible-to-query-if-two-texts-match-via-the-analyze-apis/136954/2 "2018-06-22T07:23:41Z")

</div>

Hi,

It's interesting, but \_analyze API doesn't have these features right now.  
You should to post twice and test in your code.

---

<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:** [July 20, 2018, 7:23am UTC](https://discuss.elastic.co/t/possible-to-query-if-two-texts-match-via-the-analyze-apis/136954/3 "2018-07-20T07:23:44Z")

</div>

Closed on July 20, 2018, 7:23am UTC

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