Class HighlightBase

java.lang.Object
co.elastic.clients.elasticsearch.core.search.HighlightBase
All Implemented Interfaces:
JsonpSerializable
Direct Known Subclasses:
Highlight, HighlightField

public abstract class HighlightBase extends Object implements JsonpSerializable
See Also:
  • Constructor Details

  • Method Details

    • type

      @Nullable public final String type()
      API name: type
    • boundaryChars

      @Nullable public final String boundaryChars()
      A string that contains each boundary character.

      API name: boundary_chars

    • boundaryMaxScan

      @Nullable public final Integer boundaryMaxScan()
      How far to scan for boundary characters.

      API name: boundary_max_scan

    • boundaryScanner

      @Nullable public final BoundaryScanner boundaryScanner()
      Specifies how to break the highlighted fragments: chars, sentence, or word. Only valid for the unified and fvh highlighters. Defaults to sentence for the unified highlighter. Defaults to chars for the fvh highlighter.

      API name: boundary_scanner

    • boundaryScannerLocale

      @Nullable public final String boundaryScannerLocale()
      Controls which locale is used to search for sentence and word boundaries. This parameter takes a form of a language tag, for example: "en-US", "fr-FR", "ja-JP".

      API name: boundary_scanner_locale

    • forceSource

      @Deprecated @Nullable public final Boolean forceSource()
      Deprecated.
      8.8.0
      API name: force_source
    • fragmenter

      @Nullable public final HighlighterFragmenter fragmenter()
      Specifies how text should be broken up in highlight snippets: simple or span. Only valid for the plain highlighter.

      API name: fragmenter

    • fragmentSize

      @Nullable public final Integer fragmentSize()
      The size of the highlighted fragment in characters.

      API name: fragment_size

    • highlightFilter

      @Nullable public final Boolean highlightFilter()
      API name: highlight_filter
    • highlightQuery

      @Nullable public final Query highlightQuery()
      Highlight matches for a query other than the search query. This is especially useful if you use a rescore query because those are not taken into account by highlighting by default.

      API name: highlight_query

    • maxFragmentLength

      @Nullable public final Integer maxFragmentLength()
      API name: max_fragment_length
    • maxAnalyzedOffset

      @Nullable public final Integer maxAnalyzedOffset()
      If set to a non-negative value, highlighting stops at this defined maximum limit. The rest of the text is not processed, thus not highlighted and no error is returned The max_analyzed_offset query setting does not override the index.highlight.max_analyzed_offset setting, which prevails when it’s set to lower value than the query setting.

      API name: max_analyzed_offset

    • noMatchSize

      @Nullable public final Integer noMatchSize()
      The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight.

      API name: no_match_size

    • numberOfFragments

      @Nullable public final Integer numberOfFragments()
      The maximum number of fragments to return. If the number of fragments is set to 0, no fragments are returned. Instead, the entire field contents are highlighted and returned. This can be handy when you need to highlight short texts such as a title or address, but fragmentation is not required. If number_of_fragments is 0, fragment_size is ignored.

      API name: number_of_fragments

    • options

      public final Map<String,JsonData> options()
      API name: options
    • order

      @Nullable public final HighlighterOrder order()
      Sorts highlighted fragments by score when set to score. By default, fragments will be output in the order they appear in the field (order: none). Setting this option to score will output the most relevant fragments first. Each highlighter applies its own logic to compute relevancy scores.

      API name: order

    • phraseLimit

      @Nullable public final Integer phraseLimit()
      Controls the number of matching phrases in a document that are considered. Prevents the fvh highlighter from analyzing too many phrases and consuming too much memory. When using matched_fields, phrase_limit phrases per matched field are considered. Raising the limit increases query time and consumes more memory. Only supported by the fvh highlighter.

      API name: phrase_limit

    • postTags

      public final List<String> postTags()
      Use in conjunction with pre_tags to define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in <em> and </em> tags.

      API name: post_tags

    • preTags

      public final List<String> preTags()
      Use in conjunction with post_tags to define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in <em> and </em> tags.

      API name: pre_tags

    • requireFieldMatch

      @Nullable public final Boolean requireFieldMatch()
      By default, only fields that contains a query match are highlighted. Set to false to highlight all fields.

      API name: require_field_match

    • tagsSchema

      @Nullable public final HighlighterTagsSchema tagsSchema()
      Set to styled to use the built-in tag schema.

      API name: tags_schema

    • serialize

      public void serialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
      Serialize this object to JSON.
      Specified by:
      serialize in interface JsonpSerializable
    • serializeInternal

      protected void serializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setupHighlightBaseDeserializer

      protected static <BuilderT extends HighlightBase.AbstractBuilder<BuilderT>> void setupHighlightBaseDeserializer(ObjectDeserializer<BuilderT> op)