Skip to content

[Feature Request] "_highlight" API for indices #15367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aeryaguzov opened this issue Dec 10, 2015 · 3 comments
Closed

[Feature Request] "_highlight" API for indices #15367

aeryaguzov opened this issue Dec 10, 2015 · 3 comments

Comments

@aeryaguzov
Copy link

Indices already have an _analyze API from which we can see how analyzers work.

We need the "same" API to highlight sample text with a query according to index settings (same thing is already implemented in sphinx ).

This can be useful when we do not need to store text in document, but need to highlight some text.

For now, if we want to highlight sample text, we have to index "tmp" text, highlight it, and then delete it.

@aeryaguzov
Copy link
Author

As I understand, there is no way to highlight childs in parent/child query (#1764), so this API can also be a workaround to highlight childs after search is done.

@clintongormley
Copy link
Contributor

Hi @aeryaguzov

The analyze API works because it is a process which happens before data is indexed. Highlighters require indexed terms for query matching and for term statistics. So in the end, you have to index the text.

For parent/child, you can now highlight the child documents using inner_hits:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-inner-hits.html#parent-child-inner-hits

@nik9000
Copy link
Member

nik9000 commented Dec 14, 2015

So in the end, you have to index the text.

Its a bit more complex than that. 2/3 of the highlighters require indexed text. The plain highlighter always reanalyzes on the fly, last I checked. It'd technically be possible to implement "here is some text and a query please highlight it" for all highlighters using a MemoryIndex. Its probably overkill though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants