Class GetRequestBuilder

    • Method Detail

      • setType

        public GetRequestBuilder setType​(@Nullable
                                         java.lang.String type)
        Sets the type of the document to fetch. If set to null, will use just the id to fetch the first document matching it.
      • setId

        public GetRequestBuilder setId​(java.lang.String id)
        Sets the id of the document to fetch.
      • setParent

        public GetRequestBuilder setParent​(java.lang.String parent)
        Sets the parent id of this document. Will simply set the routing to this value, as it is only used for routing with delete requests.
      • setRouting

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

        public GetRequestBuilder setPreference​(java.lang.String preference)
        Sets the preference to execute the search. Defaults to randomize across shards. Can be set to _local to prefer local shards, _primary to execute only on primary shards, or a custom value, which guarantees that the same order will be used across different requests.
      • setStoredFields

        public GetRequestBuilder setStoredFields​(java.lang.String... fields)
        Explicitly specify the fields that will be returned. By default, the _source field will be returned.
      • setFetchSource

        public GetRequestBuilder setFetchSource​(boolean fetch)
        Indicates whether the response should contain the stored _source.
        Returns:
        this for chaining
      • setFetchSource

        public GetRequestBuilder setFetchSource​(@Nullable
                                                java.lang.String include,
                                                @Nullable
                                                java.lang.String exclude)
        Indicate that _source should be returned, with an "include" and/or "exclude" set which can include simple wildcard elements.
        Parameters:
        include - An optional include (optionally wildcarded) pattern to filter the returned _source
        exclude - An optional exclude (optionally wildcarded) pattern to filter the returned _source
      • setFetchSource

        public GetRequestBuilder setFetchSource​(@Nullable
                                                java.lang.String[] includes,
                                                @Nullable
                                                java.lang.String[] excludes)
        Indicate that _source should be returned, with an "include" and/or "exclude" set which can include simple wildcard elements.
        Parameters:
        includes - An optional list of include (optionally wildcarded) pattern to filter the returned _source
        excludes - An optional list of exclude (optionally wildcarded) pattern to filter the returned _source
      • setRefresh

        public GetRequestBuilder setRefresh​(boolean refresh)
        Should a refresh be executed before this get operation causing the operation to return the latest value. Note, heavy get should not set this to true. Defaults to false.
      • setVersion

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