Highlighting without indexing document


Is there any analogue of sphinx "call snippets" api, that can highlight any text without indexing it?
In our cases, we need to send to elasticsearch:

  • Text (without indexing it before)
  • Query

And in response receive highlight data. Can it be done with current elasticsearch api? Or there could be some workaround to achieve this behavior?

This is not supported today. I guess the closest feature would be the highlight option of the percolator which allows you to highlight a document against a set of registered queries.

Thanks for fast answer. So, my workaround should be something like this:

  • Add query to elasticsearch as percolator
  • Send text to that percolator
  • Delete percolator

Is that right?
Can I post feature request somewhere to implement this feature in future?

Right that would work. You can open an issue at https://github.com/elastic/elasticsearch/issues/ with your feature request. One challenge I can think of is that highlighters typically depend on mappings so we would need to have mappings for your documents somehow.