Skip to content
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

Missing support for custom options of custom highlighter #168

Closed
leeuwr opened this issue Feb 23, 2022 · 2 comments
Closed

Missing support for custom options of custom highlighter #168

leeuwr opened this issue Feb 23, 2022 · 2 comments
Labels
Category: Enhancement New feature or request

Comments

@leeuwr
Copy link

leeuwr commented Feb 23, 2022

The RestHighLevelClient allows for custom options for a highlighted field. In DSL:

"highlight": {
    "type": "my-custom-highlighter",
    "highlight_query": {[..]}
    "order": "score",
    "fields": {
      "my-field": {
        "options": {
          "foo": "bar"
        }
      }
    }
}

In Java with RHLC that can be done with:

final HighlightBuilder.Field highlightField = new HighlightBuilder.Field("my-field")
        .options(Map.of("foo", "bar"));

However, no such support for custom options exist in new Java client. Any plans to re-introduce that functionality?


Implementation in RHLC can be found in org/elasticsearch/search/fetch/subphase/highlight/AbstractHighlighterBuilder.java:

[..]
    /**
     * Allows to set custom options for custom highlighters.
     */
    @SuppressWarnings("unchecked")
    public HB options(Map<String, Object> options) {
        this.options = options;
        return (HB) this;
    }
[..]
@swallez
Copy link
Member

swallez commented Jun 23, 2022

This is part of the larger issue #252 to add support for custom components.

@swallez swallez added the Category: Enhancement New feature or request label Jun 23, 2022
@l-trotta
Copy link
Contributor

l-trotta commented Feb 8, 2024

issue 252 has been resolved and merged, here's the documentation on how to implement custom highlighters in the new Java Rest API Client

@l-trotta l-trotta closed this as completed Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants