Class PutWatchRequest

java.lang.Object
co.elastic.clients.elasticsearch._types.RequestBase
co.elastic.clients.elasticsearch.watcher.PutWatchRequest
All Implemented Interfaces:
JsonpSerializable

@JsonpDeserializable public class PutWatchRequest extends RequestBase implements JsonpSerializable
Create or update a watch. When a watch is registered, a new document that represents the watch is added to the .watches index and its trigger is immediately registered with the relevant trigger engine. Typically for the schedule trigger, the scheduler is the trigger engine.

IMPORTANT: You must use Kibana or this API to create a watch. Do not add a watch directly to the .watches index by using the Elasticsearch index API. If Elasticsearch security features are enabled, do not give users write privileges on the .watches index.

When you add a watch you can also define its initial active state by setting the active parameter.

When Elasticsearch security features are enabled, your watch can index or search only on indices for which the user that stored the watch has privileges. If the user is able to read index a, but not index b, the same will apply when the watch runs.

See Also:
  • Field Details

  • Method Details

    • of

    • actions

      public final Map<String,Action> actions()
      The list of actions that will be run if the condition matches.

      API name: actions

    • active

      @Nullable public final Boolean active()
      The initial state of the watch. The default value is true, which means the watch is active by default.

      API name: active

    • condition

      @Nullable public final Condition condition()
      The condition that defines if the actions should be run.

      API name: condition

    • id

      public final String id()
      Required - The identifier for the watch.

      API name: id

    • ifPrimaryTerm

      @Nullable public final Long ifPrimaryTerm()
      only update the watch if the last operation that has changed the watch has the specified primary term

      API name: if_primary_term

    • ifSeqNo

      @Nullable public final Long ifSeqNo()
      only update the watch if the last operation that has changed the watch has the specified sequence number

      API name: if_seq_no

    • input

      @Nullable public final Input input()
      The input that defines the input that loads the data for the watch.

      API name: input

    • metadata

      public final Map<String,JsonData> metadata()
      Metadata JSON that will be copied into the history entries.

      API name: metadata

    • throttlePeriod

      @Nullable public final Time throttlePeriod()
      The minimum time between actions being run. The default is 5 seconds. This default can be changed in the config file with the setting xpack.watcher.throttle.period.default_period. If both this value and the throttle_period_in_millis parameter are specified, Watcher uses the last parameter included in the request.

      API name: throttle_period

    • throttlePeriodInMillis

      @Nullable public final Long throttlePeriodInMillis()
      Minimum time in milliseconds between actions being run. Defaults to 5000. If both this value and the throttle_period parameter are specified, Watcher uses the last parameter included in the request.

      API name: throttle_period_in_millis

    • transform

      @Nullable public final Transform transform()
      The transform that processes the watch payload to prepare it for the watch actions.

      API name: transform

    • trigger

      @Nullable public final Trigger trigger()
      The trigger that defines when the watch should run.

      API name: trigger

    • version

      @Nullable public final Long version()
      Explicit version number for concurrency control

      API name: version

    • 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)
    • setupPutWatchRequestDeserializer

      protected static void setupPutWatchRequestDeserializer(ObjectDeserializer<PutWatchRequest.Builder> op)