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

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)?

Hi,

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

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