Class IndexRequestBuilder

    • Method Detail

      • setType

        public IndexRequestBuilder setType​(java.lang.String type)
        Sets the type to index the document to.
      • setId

        public IndexRequestBuilder setId​(java.lang.String id)
        Sets the id to index the document under. Optional, and if not set, one will be automatically generated.
      • setRouting

        public IndexRequestBuilder setRouting​(java.lang.String routing)
        Controls the shard routing of the request. Using this value to hash the shard and not the id.
      • setParent

        public IndexRequestBuilder setParent​(java.lang.String parent)
        Sets the parent id of this document. If routing is not set, automatically set it as the routing as well.
      • setSource

        public IndexRequestBuilder setSource​(java.util.Map<java.lang.String,​?> source)
        Index the Map as a JSON.
        Parameters:
        source - The map to index
      • setSource

        public IndexRequestBuilder setSource​(java.util.Map<java.lang.String,​?> source,
                                             XContentType contentType)
        Index the Map as the provided content type.
        Parameters:
        source - The map to index
      • setSource

        public IndexRequestBuilder setSource​(byte[] source,
                                             int offset,
                                             int length,
                                             XContentType xContentType)
        Sets the document to index in bytes form (assumed to be safe to be used from different threads).
        Parameters:
        source - The source to index
        offset - The offset in the byte array
        length - The length of the data
        xContentType - The type/format of the source
      • setSource

        public IndexRequestBuilder setSource​(java.lang.Object... source)
        Constructs a simple document with a field name and value pairs.

        Note: the number of objects passed to this method must be an even number. Also the first argument in each pair (the field name) must have a valid String representation.

      • setSource

        public IndexRequestBuilder setSource​(XContentType xContentType,
                                             java.lang.Object... source)
        Constructs a simple document with a field name and value pairs.

        Note: the number of objects passed as varargs to this method must be an even number. Also the first argument in each pair (the field name) must have a valid String representation.

      • setVersion

        public IndexRequestBuilder setVersion​(long version)
        Sets the version, which will cause the index operation to only be performed if a matching version exists and no changes happened on the doc since then.
      • setPipeline

        public IndexRequestBuilder setPipeline​(java.lang.String pipeline)
        Sets the ingest pipeline to be executed before indexing the document