0

I'm sending a match query to ElasticSearch and I'm getting back documents whose matching fields have been highlighted. What I'm trying to do is to map a set of documents to the matching substring in query.

For example, assuming I query with "quick brown". I want to map the document "quick silver" to "quick", "brown fox" to "brown" and "mr brown" to "brown".

This is trivial if document fields exactly contain the word in query. But things get messy when I use fuzziness, synonyms, asciifolding etc. In that case, the highlighted parts of search results might not even appear in my search query.

Is is possible to achieve this task without replicating the analyzer logic on my application?

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
Can
  • 377
  • 2
  • 10
  • Can you post some code that illustrates your problem? Maybe a simplified version of the mapping/query that works, and what you are trying to do that doesn't work? Makes the question a little easier to attack if there is a starting point. – Sloan Ahrens Jan 08 '15 at 18:28
  • Also have you tried the [explain api](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-explain.html)? – Sloan Ahrens Jan 08 '15 at 18:28

1 Answers1

0

Use the simple query string query instead of the match query when you try to find mapped documents. And set the operator to or. So quick silver as a query will match docs with quick or silver.

priyolahiri
  • 668
  • 1
  • 5
  • 10