Class Source.Builder

All Implemented Interfaces:
WithJson<Source.Builder>, ObjectBuilder<Source>
Enclosing class:
Source

public static class Source.Builder extends WithJsonObjectBuilderBase<Source.Builder> implements ObjectBuilder<Source>
Builder for Source.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • index

      public final Source.Builder index(List<String> list)
      Required - The name of the data stream, index, or alias you are copying from. It accepts a comma-separated list to reindex from multiple sources.

      API name: index

      Adds all elements of list to index.

    • index

      public final Source.Builder index(String value, String... values)
      Required - The name of the data stream, index, or alias you are copying from. It accepts a comma-separated list to reindex from multiple sources.

      API name: index

      Adds one or more values to index.

    • query

      public final Source.Builder query(@Nullable Query value)
      The documents to reindex, which is defined with Query DSL.

      API name: query

    • query

      The documents to reindex, which is defined with Query DSL.

      API name: query

    • query

      public final Source.Builder query(QueryVariant value)
      The documents to reindex, which is defined with Query DSL.

      API name: query

    • remote

      public final Source.Builder remote(@Nullable RemoteSource value)
      A remote instance of Elasticsearch that you want to index from.

      API name: remote

    • remote

      A remote instance of Elasticsearch that you want to index from.

      API name: remote

    • size

      public final Source.Builder size(@Nullable Integer value)
      The number of documents to index per batch. Use it when you are indexing from remote to ensure that the batches fit within the on-heap buffer, which defaults to a maximum size of 100 MB.

      API name: size

    • slice

      public final Source.Builder slice(@Nullable SlicedScroll value)
      Slice the reindex request manually using the provided slice ID and total number of slices.

      API name: slice

    • slice

      Slice the reindex request manually using the provided slice ID and total number of slices.

      API name: slice

    • sort

      @Deprecated public final Source.Builder sort(List<SortOptions> list)
      Deprecated.
      7.6.0
      A comma-separated list of <field>:<direction> pairs to sort by before indexing. Use it in conjunction with max_docs to control what documents are reindexed.

      WARNING: Sort in reindex is deprecated. Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements. If used in combination with max_docs, consider using a query filter instead.

      API name: sort

      Adds all elements of list to sort.

    • sort

      @Deprecated public final Source.Builder sort(SortOptions value, SortOptions... values)
      Deprecated.
      7.6.0
      A comma-separated list of <field>:<direction> pairs to sort by before indexing. Use it in conjunction with max_docs to control what documents are reindexed.

      WARNING: Sort in reindex is deprecated. Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements. If used in combination with max_docs, consider using a query filter instead.

      API name: sort

      Adds one or more values to sort.

    • sort

      Deprecated.
      7.6.0
      A comma-separated list of <field>:<direction> pairs to sort by before indexing. Use it in conjunction with max_docs to control what documents are reindexed.

      WARNING: Sort in reindex is deprecated. Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements. If used in combination with max_docs, consider using a query filter instead.

      API name: sort

      Adds a value to sort using a builder lambda.

    • sourceFields

      public final Source.Builder sourceFields(List<String> list)
      If true, reindex all source fields. Set it to a list to reindex select fields.

      API name: _source

      Adds all elements of list to sourceFields.

    • sourceFields

      public final Source.Builder sourceFields(String value, String... values)
      If true, reindex all source fields. Set it to a list to reindex select fields.

      API name: _source

      Adds one or more values to sourceFields.

    • runtimeMappings

      public final Source.Builder runtimeMappings(Map<String,RuntimeField> map)
      API name: runtime_mappings

      Adds all entries of map to runtimeMappings.

    • runtimeMappings

      public final Source.Builder runtimeMappings(String key, RuntimeField value)
      API name: runtime_mappings

      Adds an entry to runtimeMappings.

    • runtimeMappings

      public final Source.Builder runtimeMappings(String key, Function<RuntimeField.Builder,ObjectBuilder<RuntimeField>> fn)
      API name: runtime_mappings

      Adds an entry to runtimeMappings using a builder lambda.

    • self

      protected Source.Builder self()
      Specified by:
      self in class WithJsonObjectBuilderBase<Source.Builder>
    • build

      public Source build()
      Builds a Source.
      Specified by:
      build in interface ObjectBuilder<Source>
      Throws:
      NullPointerException - if some of the required fields are null.