Skip to content

Add support for highlight queries in highlighting #2636

@rportab

Description

@rportab

Problem

I want to replace ElasticSearchRestTemplate for ElasticSearchTemplate in order to get rid of deprecated RestHighLevelClient.

There's a use case where a highlight query is needed.
Elasticsearch allows to specify a highlight query as explained in Elasticseach documentation

Version

Spring Data Elasticsearch 4.4.5

Issue

NativeSearchQueryBuilder allowed using it like this:
new NativeSearchQueryBuilder().withHighlightBuilder(new HighlightBuilder().highlightQuery(_here_comes_the_query_));

But NativeQueryBuilder does not allow it, as withHighlight method from BaseQueryBuilder accepts a Highlight and a class instead of a HighlightBuilder

Is there something I didn't see or is the possibility to add a highlight query really missing?

Please note Elasticsearch provides a Hightlight.Builder class that could be used as a replacement for HighlightBuilder

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions