Class UpdateRequest

    • Constructor Detail

      • UpdateRequest

        public UpdateRequest()
      • UpdateRequest

        public UpdateRequest​(java.lang.String index,
                             java.lang.String type,
                             java.lang.String id)
    • Method Detail

      • id

        public UpdateRequest id​(java.lang.String id)
        Sets the id of the indexed document.
      • routing

        public UpdateRequest routing​(java.lang.String routing)
        Controls the shard routing of the request. Using this value to hash the shard and not the id.
        Specified by:
        routing in interface DocWriteRequest<UpdateRequest>
        Returns:
        the Request
      • routing

        public java.lang.String routing()
        Controls the shard routing of the request. Using this value to hash the shard and not the id.
        Specified by:
        routing in interface DocWriteRequest<UpdateRequest>
        Returns:
        the Routing
      • parent

        public UpdateRequest parent​(java.lang.String parent)
        The parent id is used for the upsert request.
      • getShardId

        public ShardId getShardId()
      • script

        public Script script()
      • script

        public UpdateRequest script​(Script script)
        The script to execute. Note, make sure not to send different script each times and instead use script params if possible with the same (automatically compiled) script.
      • scriptString

        @Deprecated
        public java.lang.String scriptString()
        Deprecated.
        Use script() instead
      • scriptType

        @Deprecated
        public ScriptType scriptType()
        Deprecated.
        Use script() instead
      • scriptParams

        @Deprecated
        public java.util.Map<java.lang.String,​java.lang.Object> scriptParams()
        Deprecated.
        Use script() instead
      • script

        @Deprecated
        public UpdateRequest script​(java.lang.String script,
                                    ScriptType scriptType)
        Deprecated.
        Use script(Script) instead
        The script to execute. Note, make sure not to send different script each times and instead use script params if possible with the same (automatically compiled) script.
      • script

        @Deprecated
        public UpdateRequest script​(java.lang.String script)
        Deprecated.
        Use script(Script) instead
        The script to execute. Note, make sure not to send different script each times and instead use script params if possible with the same (automatically compiled) script.
      • scriptLang

        @Deprecated
        public UpdateRequest scriptLang​(java.lang.String scriptLang)
        Deprecated.
        Use script(Script) instead
        The language of the script to execute.
      • scriptLang

        @Deprecated
        public java.lang.String scriptLang()
        Deprecated.
        Use script() instead
      • addScriptParam

        @Deprecated
        public UpdateRequest addScriptParam​(java.lang.String name,
                                            java.lang.Object value)
        Deprecated.
        Use script(Script) instead
        Add a script parameter.
      • scriptParams

        @Deprecated
        public UpdateRequest scriptParams​(java.util.Map<java.lang.String,​java.lang.Object> scriptParams)
        Deprecated.
        Use script(Script) instead
        Sets the script parameters to use with the script.
      • script

        @Deprecated
        public UpdateRequest script​(java.lang.String script,
                                    ScriptType scriptType,
                                    @Nullable
                                    java.util.Map<java.lang.String,​java.lang.Object> scriptParams)
        Deprecated.
        Use script(Script) instead
        The script to execute. Note, make sure not to send different script each times and instead use script params if possible with the same (automatically compiled) script.
      • script

        @Deprecated
        public UpdateRequest script​(java.lang.String script,
                                    @Nullable
                                    java.lang.String scriptLang,
                                    ScriptType scriptType,
                                    @Nullable
                                    java.util.Map<java.lang.String,​java.lang.Object> scriptParams)
        Deprecated.
        Use script(Script) instead
        The script to execute. Note, make sure not to send different script each times and instead use script params if possible with the same (automatically compiled) script.
        Parameters:
        script - The script to execute
        scriptLang - The script language
        scriptType - The script type
        scriptParams - The script parameters
      • fields

        @Deprecated
        public UpdateRequest fields​(java.lang.String... fields)
        Deprecated.
        Explicitly specify the fields that will be returned. By default, nothing is returned.
      • fetchSource

        public UpdateRequest fetchSource​(@Nullable
                                         java.lang.String include,
                                         @Nullable
                                         java.lang.String exclude)
        Indicate that _source should be returned with every hit, 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
      • fetchSource

        public UpdateRequest fetchSource​(@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
      • fetchSource

        public UpdateRequest fetchSource​(boolean fetchSource)
        Indicates whether the response should contain the updated _source.
      • fields

        @Deprecated
        public java.lang.String[] fields()
        Deprecated.
        Use fetchSource() instead
        Get the fields to be returned.
      • retryOnConflict

        public UpdateRequest retryOnConflict​(int retryOnConflict)
        Sets the number of retries of a version conflict occurs because the document was updated between getting it and updating it. Defaults to 0.
      • retryOnConflict

        public int retryOnConflict()
      • doc

        public UpdateRequest doc​(java.util.Map source)
        Sets the doc to use for updates when a script is not specified.
      • doc

        public UpdateRequest doc​(java.util.Map source,
                                 XContentType contentType)
        Sets the doc to use for updates when a script is not specified.
      • doc

        public UpdateRequest doc​(java.lang.String source,
                                 XContentType xContentType)
        Sets the doc to use for updates when a script is not specified.
      • doc

        public UpdateRequest doc​(byte[] source,
                                 XContentType xContentType)
        Sets the doc to use for updates when a script is not specified.
      • doc

        public UpdateRequest doc​(byte[] source,
                                 int offset,
                                 int length,
                                 XContentType xContentType)
        Sets the doc to use for updates when a script is not specified.
      • doc

        public UpdateRequest doc​(java.lang.Object... source)
        Sets the doc to use for updates when a script is not specified, the doc provided is a field and value pairs.
      • doc

        public UpdateRequest doc​(XContentType xContentType,
                                 java.lang.Object... source)
        Sets the doc to use for updates when a script is not specified, the doc provided is a field and value pairs.
      • upsert

        public UpdateRequest upsert​(XContentBuilder source)
        Sets the doc source of the update request to be used when the document does not exists.
      • upsert

        public UpdateRequest upsert​(java.util.Map source)
        Sets the doc source of the update request to be used when the document does not exists.
      • upsert

        public UpdateRequest upsert​(java.util.Map source,
                                    XContentType contentType)
        Sets the doc source of the update request to be used when the document does not exists.
      • upsert

        public UpdateRequest upsert​(java.lang.String source,
                                    XContentType xContentType)
        Sets the doc source of the update request to be used when the document does not exists.
      • upsert

        public UpdateRequest upsert​(byte[] source,
                                    XContentType xContentType)
        Sets the doc source of the update request to be used when the document does not exists.
      • upsert

        public UpdateRequest upsert​(byte[] source,
                                    int offset,
                                    int length,
                                    XContentType xContentType)
        Sets the doc source of the update request to be used when the document does not exists.
      • upsert

        public UpdateRequest upsert​(java.lang.Object... source)
        Sets the doc source of the update request to be used when the document does not exists. The doc includes field and value pairs.
      • upsert

        public UpdateRequest upsert​(XContentType xContentType,
                                    java.lang.Object... source)
        Sets the doc source of the update request to be used when the document does not exists. The doc includes field and value pairs.
      • detectNoop

        public UpdateRequest detectNoop​(boolean detectNoop)
        Should this update attempt to detect if it is a noop? Defaults to true.
        Returns:
        this for chaining
      • detectNoop

        public boolean detectNoop()
        Should this update attempt to detect if it is a noop? Defaults to true.
      • docAsUpsert

        public boolean docAsUpsert()
      • docAsUpsert

        public UpdateRequest docAsUpsert​(boolean shouldUpsertDoc)
      • scriptedUpsert

        public boolean scriptedUpsert()
      • scriptedUpsert

        public UpdateRequest scriptedUpsert​(boolean scriptedUpsert)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object