Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
co.elastic.clients.elasticsearch.fleet.FleetSearchRequest Maven / Gradle / Ivy
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package co.elastic.clients.elasticsearch.fleet;
import co.elastic.clients.elasticsearch._types.ErrorResponse;
import co.elastic.clients.elasticsearch._types.ExpandWildcard;
import co.elastic.clients.elasticsearch._types.FieldValue;
import co.elastic.clients.elasticsearch._types.RequestBase;
import co.elastic.clients.elasticsearch._types.ScriptField;
import co.elastic.clients.elasticsearch._types.SearchType;
import co.elastic.clients.elasticsearch._types.SlicedScroll;
import co.elastic.clients.elasticsearch._types.SortOptions;
import co.elastic.clients.elasticsearch._types.Time;
import co.elastic.clients.elasticsearch._types.aggregations.Aggregation;
import co.elastic.clients.elasticsearch._types.mapping.RuntimeField;
import co.elastic.clients.elasticsearch._types.query_dsl.FieldAndFormat;
import co.elastic.clients.elasticsearch._types.query_dsl.Operator;
import co.elastic.clients.elasticsearch._types.query_dsl.Query;
import co.elastic.clients.elasticsearch.core.search.FieldCollapse;
import co.elastic.clients.elasticsearch.core.search.Highlight;
import co.elastic.clients.elasticsearch.core.search.PointInTimeReference;
import co.elastic.clients.elasticsearch.core.search.Rescore;
import co.elastic.clients.elasticsearch.core.search.SourceConfig;
import co.elastic.clients.elasticsearch.core.search.Suggester;
import co.elastic.clients.elasticsearch.core.search.TrackHits;
import co.elastic.clients.json.JsonData;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.JsonpMapper;
import co.elastic.clients.json.JsonpSerializable;
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.transport.Endpoint;
import co.elastic.clients.transport.endpoints.SimpleEndpoint;
import co.elastic.clients.util.ApiTypeHelper;
import co.elastic.clients.util.ObjectBuilder;
import jakarta.json.stream.JsonGenerator;
import java.lang.Boolean;
import java.lang.Double;
import java.lang.Integer;
import java.lang.Long;
import java.lang.String;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
//----------------------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------------------
//
// This code is generated from the Elasticsearch API specification
// at https://github.com/elastic/elasticsearch-specification
//
// Manual updates to this file will be lost when the code is
// re-generated.
//
// If you find a property that is missing or wrongly typed, please
// open an issue or a PR on the API specification repository.
//
//----------------------------------------------------------------
// typedef: fleet.search.Request
/**
* The purpose of the fleet search api is to provide a search api where the
* search will only be executed after provided checkpoint has been processed and
* is visible for searches inside of Elasticsearch.
*
* @see API
* specification
*/
@JsonpDeserializable
public class FleetSearchRequest extends RequestBase implements JsonpSerializable {
@Nullable
private final SourceConfig source;
private final Map aggregations;
@Nullable
private final Boolean allowNoIndices;
@Nullable
private final Boolean allowPartialSearchResults;
@Nullable
private final Boolean analyzeWildcard;
@Nullable
private final String analyzer;
@Nullable
private final Long batchedReduceSize;
@Nullable
private final Boolean ccsMinimizeRoundtrips;
@Nullable
private final FieldCollapse collapse;
@Nullable
private final Operator defaultOperator;
@Nullable
private final String df;
private final List docvalueFields;
private final List expandWildcards;
@Nullable
private final Boolean explain;
private final Map ext;
private final List fields;
@Nullable
private final Integer from;
@Nullable
private final Highlight highlight;
@Nullable
private final Boolean ignoreThrottled;
@Nullable
private final Boolean ignoreUnavailable;
private final String index;
private final List> indicesBoost;
@Nullable
private final Boolean lenient;
@Nullable
private final Long maxConcurrentShardRequests;
@Nullable
private final String minCompatibleShardNode;
@Nullable
private final Double minScore;
@Nullable
private final PointInTimeReference pit;
@Nullable
private final Query postFilter;
@Nullable
private final Long preFilterShardSize;
@Nullable
private final String preference;
@Nullable
private final Boolean profile;
@Nullable
private final String q;
@Nullable
private final Query query;
@Nullable
private final Boolean requestCache;
private final List rescore;
@Nullable
private final String routing;
private final Map runtimeMappings;
private final Map scriptFields;
@Nullable
private final Time scroll;
private final List searchAfter;
@Nullable
private final SearchType searchType;
@Nullable
private final Boolean seqNoPrimaryTerm;
@Nullable
private final Integer size;
@Nullable
private final SlicedScroll slice;
private final List sort;
private final List stats;
private final List storedFields;
@Nullable
private final Suggester suggest;
@Nullable
private final Long terminateAfter;
@Nullable
private final String timeout;
@Nullable
private final Boolean trackScores;
@Nullable
private final TrackHits trackTotalHits;
@Nullable
private final Boolean version;
private final List waitForCheckpoints;
// ---------------------------------------------------------------------------------------------
private FleetSearchRequest(Builder builder) {
this.source = builder.source;
this.aggregations = ApiTypeHelper.unmodifiable(builder.aggregations);
this.allowNoIndices = builder.allowNoIndices;
this.allowPartialSearchResults = builder.allowPartialSearchResults;
this.analyzeWildcard = builder.analyzeWildcard;
this.analyzer = builder.analyzer;
this.batchedReduceSize = builder.batchedReduceSize;
this.ccsMinimizeRoundtrips = builder.ccsMinimizeRoundtrips;
this.collapse = builder.collapse;
this.defaultOperator = builder.defaultOperator;
this.df = builder.df;
this.docvalueFields = ApiTypeHelper.unmodifiable(builder.docvalueFields);
this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards);
this.explain = builder.explain;
this.ext = ApiTypeHelper.unmodifiable(builder.ext);
this.fields = ApiTypeHelper.unmodifiable(builder.fields);
this.from = builder.from;
this.highlight = builder.highlight;
this.ignoreThrottled = builder.ignoreThrottled;
this.ignoreUnavailable = builder.ignoreUnavailable;
this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index");
this.indicesBoost = ApiTypeHelper.unmodifiable(builder.indicesBoost);
this.lenient = builder.lenient;
this.maxConcurrentShardRequests = builder.maxConcurrentShardRequests;
this.minCompatibleShardNode = builder.minCompatibleShardNode;
this.minScore = builder.minScore;
this.pit = builder.pit;
this.postFilter = builder.postFilter;
this.preFilterShardSize = builder.preFilterShardSize;
this.preference = builder.preference;
this.profile = builder.profile;
this.q = builder.q;
this.query = builder.query;
this.requestCache = builder.requestCache;
this.rescore = ApiTypeHelper.unmodifiable(builder.rescore);
this.routing = builder.routing;
this.runtimeMappings = ApiTypeHelper.unmodifiable(builder.runtimeMappings);
this.scriptFields = ApiTypeHelper.unmodifiable(builder.scriptFields);
this.scroll = builder.scroll;
this.searchAfter = ApiTypeHelper.unmodifiable(builder.searchAfter);
this.searchType = builder.searchType;
this.seqNoPrimaryTerm = builder.seqNoPrimaryTerm;
this.size = builder.size;
this.slice = builder.slice;
this.sort = ApiTypeHelper.unmodifiable(builder.sort);
this.stats = ApiTypeHelper.unmodifiable(builder.stats);
this.storedFields = ApiTypeHelper.unmodifiable(builder.storedFields);
this.suggest = builder.suggest;
this.terminateAfter = builder.terminateAfter;
this.timeout = builder.timeout;
this.trackScores = builder.trackScores;
this.trackTotalHits = builder.trackTotalHits;
this.version = builder.version;
this.waitForCheckpoints = ApiTypeHelper.unmodifiable(builder.waitForCheckpoints);
}
public static FleetSearchRequest of(Function> fn) {
return fn.apply(new Builder()).build();
}
/**
* Indicates which source fields are returned for matching documents. These
* fields are returned in the hits._source property of the search response.
*
* API name: {@code _source}
*/
@Nullable
public final SourceConfig source() {
return this.source;
}
/**
* API name: {@code aggregations}
*/
public final Map aggregations() {
return this.aggregations;
}
/**
* API name: {@code allow_no_indices}
*/
@Nullable
public final Boolean allowNoIndices() {
return this.allowNoIndices;
}
/**
* If true, returns partial results if there are shard request timeouts or
* shard
* failures . If false, returns an error with no partial results. Defaults to
* the configured cluster setting
* search.default_allow_partial_results
which is true by default.
*
* API name: {@code allow_partial_search_results}
*/
@Nullable
public final Boolean allowPartialSearchResults() {
return this.allowPartialSearchResults;
}
/**
* API name: {@code analyze_wildcard}
*/
@Nullable
public final Boolean analyzeWildcard() {
return this.analyzeWildcard;
}
/**
* API name: {@code analyzer}
*/
@Nullable
public final String analyzer() {
return this.analyzer;
}
/**
* API name: {@code batched_reduce_size}
*/
@Nullable
public final Long batchedReduceSize() {
return this.batchedReduceSize;
}
/**
* API name: {@code ccs_minimize_roundtrips}
*/
@Nullable
public final Boolean ccsMinimizeRoundtrips() {
return this.ccsMinimizeRoundtrips;
}
/**
* API name: {@code collapse}
*/
@Nullable
public final FieldCollapse collapse() {
return this.collapse;
}
/**
* API name: {@code default_operator}
*/
@Nullable
public final Operator defaultOperator() {
return this.defaultOperator;
}
/**
* API name: {@code df}
*/
@Nullable
public final String df() {
return this.df;
}
/**
* Array of wildcard (*) patterns. The request returns doc values for field
* names matching these patterns in the hits.fields property of the response.
*
* API name: {@code docvalue_fields}
*/
public final List docvalueFields() {
return this.docvalueFields;
}
/**
* API name: {@code expand_wildcards}
*/
public final List expandWildcards() {
return this.expandWildcards;
}
/**
* If true, returns detailed information about score computation as part of a
* hit.
*
* API name: {@code explain}
*/
@Nullable
public final Boolean explain() {
return this.explain;
}
/**
* Configuration of search extensions defined by Elasticsearch plugins.
*
* API name: {@code ext}
*/
public final Map ext() {
return this.ext;
}
/**
* Array of wildcard (*) patterns. The request returns values for field names
* matching these patterns in the hits.fields property of the response.
*
* API name: {@code fields}
*/
public final List fields() {
return this.fields;
}
/**
* Starting document offset. By default, you cannot page through more than
* 10,000 hits using the from and size parameters. To page through more hits,
* use the search_after parameter.
*
* API name: {@code from}
*/
@Nullable
public final Integer from() {
return this.from;
}
/**
* API name: {@code highlight}
*/
@Nullable
public final Highlight highlight() {
return this.highlight;
}
/**
* API name: {@code ignore_throttled}
*/
@Nullable
public final Boolean ignoreThrottled() {
return this.ignoreThrottled;
}
/**
* API name: {@code ignore_unavailable}
*/
@Nullable
public final Boolean ignoreUnavailable() {
return this.ignoreUnavailable;
}
/**
* Required - A single target to search. If the target is an index alias, it
* must resolve to a single index.
*
* API name: {@code index}
*/
public final String index() {
return this.index;
}
/**
* Boosts the _score of documents from specified indices.
*
* API name: {@code indices_boost}
*/
public final List> indicesBoost() {
return this.indicesBoost;
}
/**
* API name: {@code lenient}
*/
@Nullable
public final Boolean lenient() {
return this.lenient;
}
/**
* API name: {@code max_concurrent_shard_requests}
*/
@Nullable
public final Long maxConcurrentShardRequests() {
return this.maxConcurrentShardRequests;
}
/**
* API name: {@code min_compatible_shard_node}
*/
@Nullable
public final String minCompatibleShardNode() {
return this.minCompatibleShardNode;
}
/**
* Minimum _score for matching documents. Documents with a lower _score are not
* included in the search results.
*
* API name: {@code min_score}
*/
@Nullable
public final Double minScore() {
return this.minScore;
}
/**
* Limits the search to a point in time (PIT). If you provide a PIT, you cannot
* specify an <index> in the request path.
*
* API name: {@code pit}
*/
@Nullable
public final PointInTimeReference pit() {
return this.pit;
}
/**
* API name: {@code post_filter}
*/
@Nullable
public final Query postFilter() {
return this.postFilter;
}
/**
* API name: {@code pre_filter_shard_size}
*/
@Nullable
public final Long preFilterShardSize() {
return this.preFilterShardSize;
}
/**
* API name: {@code preference}
*/
@Nullable
public final String preference() {
return this.preference;
}
/**
* API name: {@code profile}
*/
@Nullable
public final Boolean profile() {
return this.profile;
}
/**
* API name: {@code q}
*/
@Nullable
public final String q() {
return this.q;
}
/**
* Defines the search definition using the Query DSL.
*
* API name: {@code query}
*/
@Nullable
public final Query query() {
return this.query;
}
/**
* API name: {@code request_cache}
*/
@Nullable
public final Boolean requestCache() {
return this.requestCache;
}
/**
* API name: {@code rescore}
*/
public final List rescore() {
return this.rescore;
}
/**
* API name: {@code routing}
*/
@Nullable
public final String routing() {
return this.routing;
}
/**
* Defines one or more runtime fields in the search request. These fields take
* precedence over mapped fields with the same name.
*
* API name: {@code runtime_mappings}
*/
public final Map runtimeMappings() {
return this.runtimeMappings;
}
/**
* Retrieve a script evaluation (based on different fields) for each hit.
*
* API name: {@code script_fields}
*/
public final Map scriptFields() {
return this.scriptFields;
}
/**
* API name: {@code scroll}
*/
@Nullable
public final Time scroll() {
return this.scroll;
}
/**
* API name: {@code search_after}
*/
public final List searchAfter() {
return this.searchAfter;
}
/**
* API name: {@code search_type}
*/
@Nullable
public final SearchType searchType() {
return this.searchType;
}
/**
* If true, returns sequence number and primary term of the last modification of
* each hit. See Optimistic concurrency control.
*
* API name: {@code seq_no_primary_term}
*/
@Nullable
public final Boolean seqNoPrimaryTerm() {
return this.seqNoPrimaryTerm;
}
/**
* The number of hits to return. By default, you cannot page through more than
* 10,000 hits using the from and size parameters. To page through more hits,
* use the search_after parameter.
*
* API name: {@code size}
*/
@Nullable
public final Integer size() {
return this.size;
}
/**
* API name: {@code slice}
*/
@Nullable
public final SlicedScroll slice() {
return this.slice;
}
/**
* API name: {@code sort}
*/
public final List sort() {
return this.sort;
}
/**
* Stats groups to associate with the search. Each group maintains a statistics
* aggregation for its associated searches. You can retrieve these stats using
* the indices stats API.
*
* API name: {@code stats}
*/
public final List stats() {
return this.stats;
}
/**
* List of stored fields to return as part of a hit. If no fields are specified,
* no stored fields are included in the response. If this field is specified,
* the _source parameter defaults to false. You can pass _source: true to return
* both source fields and stored fields in the search response.
*
* API name: {@code stored_fields}
*/
public final List storedFields() {
return this.storedFields;
}
/**
* API name: {@code suggest}
*/
@Nullable
public final Suggester suggest() {
return this.suggest;
}
/**
* Maximum number of documents to collect for each shard. If a query reaches
* this limit, Elasticsearch terminates the query early. Elasticsearch collects
* documents before sorting. Defaults to 0, which does not terminate query
* execution early.
*
* API name: {@code terminate_after}
*/
@Nullable
public final Long terminateAfter() {
return this.terminateAfter;
}
/**
* Specifies the period of time to wait for a response from each shard. If no
* response is received before the timeout expires, the request fails and
* returns an error. Defaults to no timeout.
*
* API name: {@code timeout}
*/
@Nullable
public final String timeout() {
return this.timeout;
}
/**
* If true, calculate and return document scores, even if the scores are not
* used for sorting.
*
* API name: {@code track_scores}
*/
@Nullable
public final Boolean trackScores() {
return this.trackScores;
}
/**
* Number of hits matching the query to count accurately. If true, the exact
* number of hits is returned at the cost of some performance. If false, the
* response does not include the total number of hits matching the query.
* Defaults to 10,000 hits.
*
* API name: {@code track_total_hits}
*/
@Nullable
public final TrackHits trackTotalHits() {
return this.trackTotalHits;
}
/**
* If true, returns document version as part of a hit.
*
* API name: {@code version}
*/
@Nullable
public final Boolean version() {
return this.version;
}
/**
* A comma separated list of checkpoints. When configured, the search API will
* only be executed on a shard after the relevant checkpoint has become visible
* for search. Defaults to an empty list which will cause Elasticsearch to
* immediately execute the search.
*
* API name: {@code wait_for_checkpoints}
*/
public final List waitForCheckpoints() {
return this.waitForCheckpoints;
}
/**
* Serialize this object to JSON.
*/
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartObject();
serializeInternal(generator, mapper);
generator.writeEnd();
}
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (this.source != null) {
generator.writeKey("_source");
this.source.serialize(generator, mapper);
}
if (ApiTypeHelper.isDefined(this.aggregations)) {
generator.writeKey("aggregations");
generator.writeStartObject();
for (Map.Entry item0 : this.aggregations.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);
}
generator.writeEnd();
}
if (this.collapse != null) {
generator.writeKey("collapse");
this.collapse.serialize(generator, mapper);
}
if (ApiTypeHelper.isDefined(this.docvalueFields)) {
generator.writeKey("docvalue_fields");
generator.writeStartArray();
for (FieldAndFormat item0 : this.docvalueFields) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
if (this.explain != null) {
generator.writeKey("explain");
generator.write(this.explain);
}
if (ApiTypeHelper.isDefined(this.ext)) {
generator.writeKey("ext");
generator.writeStartObject();
for (Map.Entry item0 : this.ext.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.fields)) {
generator.writeKey("fields");
generator.writeStartArray();
for (FieldAndFormat item0 : this.fields) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
if (this.from != null) {
generator.writeKey("from");
generator.write(this.from);
}
if (this.highlight != null) {
generator.writeKey("highlight");
this.highlight.serialize(generator, mapper);
}
if (ApiTypeHelper.isDefined(this.indicesBoost)) {
generator.writeKey("indices_boost");
generator.writeStartArray();
for (Map item0 : this.indicesBoost) {
generator.writeStartObject();
if (item0 != null) {
for (Map.Entry item1 : item0.entrySet()) {
generator.writeKey(item1.getKey());
generator.write(item1.getValue());
}
}
generator.writeEnd();
}
generator.writeEnd();
}
if (this.minScore != null) {
generator.writeKey("min_score");
generator.write(this.minScore);
}
if (this.pit != null) {
generator.writeKey("pit");
this.pit.serialize(generator, mapper);
}
if (this.postFilter != null) {
generator.writeKey("post_filter");
this.postFilter.serialize(generator, mapper);
}
if (this.profile != null) {
generator.writeKey("profile");
generator.write(this.profile);
}
if (this.query != null) {
generator.writeKey("query");
this.query.serialize(generator, mapper);
}
if (ApiTypeHelper.isDefined(this.rescore)) {
generator.writeKey("rescore");
generator.writeStartArray();
for (Rescore item0 : this.rescore) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.runtimeMappings)) {
generator.writeKey("runtime_mappings");
generator.writeStartObject();
for (Map.Entry item0 : this.runtimeMappings.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.scriptFields)) {
generator.writeKey("script_fields");
generator.writeStartObject();
for (Map.Entry item0 : this.scriptFields.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.searchAfter)) {
generator.writeKey("search_after");
generator.writeStartArray();
for (FieldValue item0 : this.searchAfter) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
if (this.seqNoPrimaryTerm != null) {
generator.writeKey("seq_no_primary_term");
generator.write(this.seqNoPrimaryTerm);
}
if (this.size != null) {
generator.writeKey("size");
generator.write(this.size);
}
if (this.slice != null) {
generator.writeKey("slice");
this.slice.serialize(generator, mapper);
}
if (ApiTypeHelper.isDefined(this.sort)) {
generator.writeKey("sort");
generator.writeStartArray();
for (SortOptions item0 : this.sort) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.stats)) {
generator.writeKey("stats");
generator.writeStartArray();
for (String item0 : this.stats) {
generator.write(item0);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.storedFields)) {
generator.writeKey("stored_fields");
if (this.storedFields.size() == 1) {
String singleItem = this.storedFields.get(0);
generator.write(singleItem);
} else {
generator.writeStartArray();
for (String item0 : this.storedFields) {
generator.write(item0);
}
generator.writeEnd();
}
}
if (this.suggest != null) {
generator.writeKey("suggest");
this.suggest.serialize(generator, mapper);
}
if (this.terminateAfter != null) {
generator.writeKey("terminate_after");
generator.write(this.terminateAfter);
}
if (this.timeout != null) {
generator.writeKey("timeout");
generator.write(this.timeout);
}
if (this.trackScores != null) {
generator.writeKey("track_scores");
generator.write(this.trackScores);
}
if (this.trackTotalHits != null) {
generator.writeKey("track_total_hits");
this.trackTotalHits.serialize(generator, mapper);
}
if (this.version != null) {
generator.writeKey("version");
generator.write(this.version);
}
}
// ---------------------------------------------------------------------------------------------
/**
* Builder for {@link FleetSearchRequest}.
*/
public static class Builder extends RequestBase.AbstractBuilder
implements
ObjectBuilder {
@Nullable
private SourceConfig source;
@Nullable
private Map aggregations;
@Nullable
private Boolean allowNoIndices;
@Nullable
private Boolean allowPartialSearchResults;
@Nullable
private Boolean analyzeWildcard;
@Nullable
private String analyzer;
@Nullable
private Long batchedReduceSize;
@Nullable
private Boolean ccsMinimizeRoundtrips;
@Nullable
private FieldCollapse collapse;
@Nullable
private Operator defaultOperator;
@Nullable
private String df;
@Nullable
private List docvalueFields;
@Nullable
private List expandWildcards;
@Nullable
private Boolean explain;
@Nullable
private Map ext;
@Nullable
private List fields;
@Nullable
private Integer from;
@Nullable
private Highlight highlight;
@Nullable
private Boolean ignoreThrottled;
@Nullable
private Boolean ignoreUnavailable;
private String index;
@Nullable
private List> indicesBoost;
@Nullable
private Boolean lenient;
@Nullable
private Long maxConcurrentShardRequests;
@Nullable
private String minCompatibleShardNode;
@Nullable
private Double minScore;
@Nullable
private PointInTimeReference pit;
@Nullable
private Query postFilter;
@Nullable
private Long preFilterShardSize;
@Nullable
private String preference;
@Nullable
private Boolean profile;
@Nullable
private String q;
@Nullable
private Query query;
@Nullable
private Boolean requestCache;
@Nullable
private List rescore;
@Nullable
private String routing;
@Nullable
private Map runtimeMappings;
@Nullable
private Map scriptFields;
@Nullable
private Time scroll;
@Nullable
private List searchAfter;
@Nullable
private SearchType searchType;
@Nullable
private Boolean seqNoPrimaryTerm;
@Nullable
private Integer size;
@Nullable
private SlicedScroll slice;
@Nullable
private List sort;
@Nullable
private List stats;
@Nullable
private List storedFields;
@Nullable
private Suggester suggest;
@Nullable
private Long terminateAfter;
@Nullable
private String timeout;
@Nullable
private Boolean trackScores;
@Nullable
private TrackHits trackTotalHits;
@Nullable
private Boolean version;
@Nullable
private List waitForCheckpoints;
/**
* Indicates which source fields are returned for matching documents. These
* fields are returned in the hits._source property of the search response.
*
* API name: {@code _source}
*/
public final Builder source(@Nullable SourceConfig value) {
this.source = value;
return this;
}
/**
* Indicates which source fields are returned for matching documents. These
* fields are returned in the hits._source property of the search response.
*
* API name: {@code _source}
*/
public final Builder source(Function> fn) {
return this.source(fn.apply(new SourceConfig.Builder()).build());
}
/**
* API name: {@code aggregations}
*
* Adds all entries of map
to aggregations
.
*/
public final Builder aggregations(Map map) {
this.aggregations = _mapPutAll(this.aggregations, map);
return this;
}
/**
* API name: {@code aggregations}
*
* Adds an entry to aggregations
.
*/
public final Builder aggregations(String key, Aggregation value) {
this.aggregations = _mapPut(this.aggregations, key, value);
return this;
}
/**
* API name: {@code aggregations}
*
* Adds an entry to aggregations
using a builder lambda.
*/
public final Builder aggregations(String key, Function> fn) {
return aggregations(key, fn.apply(new Aggregation.Builder()).build());
}
/**
* API name: {@code allow_no_indices}
*/
public final Builder allowNoIndices(@Nullable Boolean value) {
this.allowNoIndices = value;
return this;
}
/**
* If true, returns partial results if there are shard request timeouts or
* shard
* failures . If false, returns an error with no partial results. Defaults to
* the configured cluster setting
* search.default_allow_partial_results
which is true by default.
*
* API name: {@code allow_partial_search_results}
*/
public final Builder allowPartialSearchResults(@Nullable Boolean value) {
this.allowPartialSearchResults = value;
return this;
}
/**
* API name: {@code analyze_wildcard}
*/
public final Builder analyzeWildcard(@Nullable Boolean value) {
this.analyzeWildcard = value;
return this;
}
/**
* API name: {@code analyzer}
*/
public final Builder analyzer(@Nullable String value) {
this.analyzer = value;
return this;
}
/**
* API name: {@code batched_reduce_size}
*/
public final Builder batchedReduceSize(@Nullable Long value) {
this.batchedReduceSize = value;
return this;
}
/**
* API name: {@code ccs_minimize_roundtrips}
*/
public final Builder ccsMinimizeRoundtrips(@Nullable Boolean value) {
this.ccsMinimizeRoundtrips = value;
return this;
}
/**
* API name: {@code collapse}
*/
public final Builder collapse(@Nullable FieldCollapse value) {
this.collapse = value;
return this;
}
/**
* API name: {@code collapse}
*/
public final Builder collapse(Function> fn) {
return this.collapse(fn.apply(new FieldCollapse.Builder()).build());
}
/**
* API name: {@code default_operator}
*/
public final Builder defaultOperator(@Nullable Operator value) {
this.defaultOperator = value;
return this;
}
/**
* API name: {@code df}
*/
public final Builder df(@Nullable String value) {
this.df = value;
return this;
}
/**
* Array of wildcard (*) patterns. The request returns doc values for field
* names matching these patterns in the hits.fields property of the response.
*
* API name: {@code docvalue_fields}
*
* Adds all elements of list
to docvalueFields
.
*/
public final Builder docvalueFields(List list) {
this.docvalueFields = _listAddAll(this.docvalueFields, list);
return this;
}
/**
* Array of wildcard (*) patterns. The request returns doc values for field
* names matching these patterns in the hits.fields property of the response.
*
* API name: {@code docvalue_fields}
*
* Adds one or more values to docvalueFields
.
*/
public final Builder docvalueFields(FieldAndFormat value, FieldAndFormat... values) {
this.docvalueFields = _listAdd(this.docvalueFields, value, values);
return this;
}
/**
* Array of wildcard (*) patterns. The request returns doc values for field
* names matching these patterns in the hits.fields property of the response.
*
* API name: {@code docvalue_fields}
*
* Adds a value to docvalueFields
using a builder lambda.
*/
public final Builder docvalueFields(Function> fn) {
return docvalueFields(fn.apply(new FieldAndFormat.Builder()).build());
}
/**
* API name: {@code expand_wildcards}
*
* Adds all elements of list
to expandWildcards
.
*/
public final Builder expandWildcards(List list) {
this.expandWildcards = _listAddAll(this.expandWildcards, list);
return this;
}
/**
* API name: {@code expand_wildcards}
*
* Adds one or more values to expandWildcards
.
*/
public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) {
this.expandWildcards = _listAdd(this.expandWildcards, value, values);
return this;
}
/**
* If true, returns detailed information about score computation as part of a
* hit.
*
* API name: {@code explain}
*/
public final Builder explain(@Nullable Boolean value) {
this.explain = value;
return this;
}
/**
* Configuration of search extensions defined by Elasticsearch plugins.
*
* API name: {@code ext}
*
* Adds all entries of map
to ext
.
*/
public final Builder ext(Map map) {
this.ext = _mapPutAll(this.ext, map);
return this;
}
/**
* Configuration of search extensions defined by Elasticsearch plugins.
*
* API name: {@code ext}
*
* Adds an entry to ext
.
*/
public final Builder ext(String key, JsonData value) {
this.ext = _mapPut(this.ext, key, value);
return this;
}
/**
* Array of wildcard (*) patterns. The request returns values for field names
* matching these patterns in the hits.fields property of the response.
*
* API name: {@code fields}
*
* Adds all elements of list
to fields
.
*/
public final Builder fields(List list) {
this.fields = _listAddAll(this.fields, list);
return this;
}
/**
* Array of wildcard (*) patterns. The request returns values for field names
* matching these patterns in the hits.fields property of the response.
*
* API name: {@code fields}
*
* Adds one or more values to fields
.
*/
public final Builder fields(FieldAndFormat value, FieldAndFormat... values) {
this.fields = _listAdd(this.fields, value, values);
return this;
}
/**
* Array of wildcard (*) patterns. The request returns values for field names
* matching these patterns in the hits.fields property of the response.
*
* API name: {@code fields}
*
* Adds a value to fields
using a builder lambda.
*/
public final Builder fields(Function> fn) {
return fields(fn.apply(new FieldAndFormat.Builder()).build());
}
/**
* Starting document offset. By default, you cannot page through more than
* 10,000 hits using the from and size parameters. To page through more hits,
* use the search_after parameter.
*
* API name: {@code from}
*/
public final Builder from(@Nullable Integer value) {
this.from = value;
return this;
}
/**
* API name: {@code highlight}
*/
public final Builder highlight(@Nullable Highlight value) {
this.highlight = value;
return this;
}
/**
* API name: {@code highlight}
*/
public final Builder highlight(Function> fn) {
return this.highlight(fn.apply(new Highlight.Builder()).build());
}
/**
* API name: {@code ignore_throttled}
*/
public final Builder ignoreThrottled(@Nullable Boolean value) {
this.ignoreThrottled = value;
return this;
}
/**
* API name: {@code ignore_unavailable}
*/
public final Builder ignoreUnavailable(@Nullable Boolean value) {
this.ignoreUnavailable = value;
return this;
}
/**
* Required - A single target to search. If the target is an index alias, it
* must resolve to a single index.
*
* API name: {@code index}
*/
public final Builder index(String value) {
this.index = value;
return this;
}
/**
* Boosts the _score of documents from specified indices.
*
* API name: {@code indices_boost}
*
* Adds all elements of list
to indicesBoost
.
*/
public final Builder indicesBoost(List> list) {
this.indicesBoost = _listAddAll(this.indicesBoost, list);
return this;
}
/**
* Boosts the _score of documents from specified indices.
*
* API name: {@code indices_boost}
*
* Adds one or more values to indicesBoost
.
*/
public final Builder indicesBoost(Map value, Map... values) {
this.indicesBoost = _listAdd(this.indicesBoost, value, values);
return this;
}
/**
* API name: {@code lenient}
*/
public final Builder lenient(@Nullable Boolean value) {
this.lenient = value;
return this;
}
/**
* API name: {@code max_concurrent_shard_requests}
*/
public final Builder maxConcurrentShardRequests(@Nullable Long value) {
this.maxConcurrentShardRequests = value;
return this;
}
/**
* API name: {@code min_compatible_shard_node}
*/
public final Builder minCompatibleShardNode(@Nullable String value) {
this.minCompatibleShardNode = value;
return this;
}
/**
* Minimum _score for matching documents. Documents with a lower _score are not
* included in the search results.
*
* API name: {@code min_score}
*/
public final Builder minScore(@Nullable Double value) {
this.minScore = value;
return this;
}
/**
* Limits the search to a point in time (PIT). If you provide a PIT, you cannot
* specify an <index> in the request path.
*
* API name: {@code pit}
*/
public final Builder pit(@Nullable PointInTimeReference value) {
this.pit = value;
return this;
}
/**
* Limits the search to a point in time (PIT). If you provide a PIT, you cannot
* specify an <index> in the request path.
*
* API name: {@code pit}
*/
public final Builder pit(Function> fn) {
return this.pit(fn.apply(new PointInTimeReference.Builder()).build());
}
/**
* API name: {@code post_filter}
*/
public final Builder postFilter(@Nullable Query value) {
this.postFilter = value;
return this;
}
/**
* API name: {@code post_filter}
*/
public final Builder postFilter(Function> fn) {
return this.postFilter(fn.apply(new Query.Builder()).build());
}
/**
* API name: {@code pre_filter_shard_size}
*/
public final Builder preFilterShardSize(@Nullable Long value) {
this.preFilterShardSize = value;
return this;
}
/**
* API name: {@code preference}
*/
public final Builder preference(@Nullable String value) {
this.preference = value;
return this;
}
/**
* API name: {@code profile}
*/
public final Builder profile(@Nullable Boolean value) {
this.profile = value;
return this;
}
/**
* API name: {@code q}
*/
public final Builder q(@Nullable String value) {
this.q = value;
return this;
}
/**
* Defines the search definition using the Query DSL.
*
* API name: {@code query}
*/
public final Builder query(@Nullable Query value) {
this.query = value;
return this;
}
/**
* Defines the search definition using the Query DSL.
*
* API name: {@code query}
*/
public final Builder query(Function> fn) {
return this.query(fn.apply(new Query.Builder()).build());
}
/**
* API name: {@code request_cache}
*/
public final Builder requestCache(@Nullable Boolean value) {
this.requestCache = value;
return this;
}
/**
* API name: {@code rescore}
*
* Adds all elements of list
to rescore
.
*/
public final Builder rescore(List list) {
this.rescore = _listAddAll(this.rescore, list);
return this;
}
/**
* API name: {@code rescore}
*
* Adds one or more values to rescore
.
*/
public final Builder rescore(Rescore value, Rescore... values) {
this.rescore = _listAdd(this.rescore, value, values);
return this;
}
/**
* API name: {@code rescore}
*
* Adds a value to rescore
using a builder lambda.
*/
public final Builder rescore(Function> fn) {
return rescore(fn.apply(new Rescore.Builder()).build());
}
/**
* API name: {@code routing}
*/
public final Builder routing(@Nullable String value) {
this.routing = value;
return this;
}
/**
* Defines one or more runtime fields in the search request. These fields take
* precedence over mapped fields with the same name.
*
* API name: {@code runtime_mappings}
*
* Adds all entries of map
to runtimeMappings
.
*/
public final Builder runtimeMappings(Map map) {
this.runtimeMappings = _mapPutAll(this.runtimeMappings, map);
return this;
}
/**
* Defines one or more runtime fields in the search request. These fields take
* precedence over mapped fields with the same name.
*
* API name: {@code runtime_mappings}
*
* Adds an entry to runtimeMappings
.
*/
public final Builder runtimeMappings(String key, RuntimeField value) {
this.runtimeMappings = _mapPut(this.runtimeMappings, key, value);
return this;
}
/**
* Defines one or more runtime fields in the search request. These fields take
* precedence over mapped fields with the same name.
*
* API name: {@code runtime_mappings}
*
* Adds an entry to runtimeMappings
using a builder lambda.
*/
public final Builder runtimeMappings(String key,
Function> fn) {
return runtimeMappings(key, fn.apply(new RuntimeField.Builder()).build());
}
/**
* Retrieve a script evaluation (based on different fields) for each hit.
*
* API name: {@code script_fields}
*
* Adds all entries of map
to scriptFields
.
*/
public final Builder scriptFields(Map map) {
this.scriptFields = _mapPutAll(this.scriptFields, map);
return this;
}
/**
* Retrieve a script evaluation (based on different fields) for each hit.
*
* API name: {@code script_fields}
*
* Adds an entry to scriptFields
.
*/
public final Builder scriptFields(String key, ScriptField value) {
this.scriptFields = _mapPut(this.scriptFields, key, value);
return this;
}
/**
* Retrieve a script evaluation (based on different fields) for each hit.
*
* API name: {@code script_fields}
*
* Adds an entry to scriptFields
using a builder lambda.
*/
public final Builder scriptFields(String key, Function> fn) {
return scriptFields(key, fn.apply(new ScriptField.Builder()).build());
}
/**
* API name: {@code scroll}
*/
public final Builder scroll(@Nullable Time value) {
this.scroll = value;
return this;
}
/**
* API name: {@code scroll}
*/
public final Builder scroll(Function> fn) {
return this.scroll(fn.apply(new Time.Builder()).build());
}
/**
* API name: {@code search_after}
*
* Adds all elements of list
to searchAfter
.
*/
public final Builder searchAfter(List list) {
this.searchAfter = _listAddAll(this.searchAfter, list);
return this;
}
/**
* API name: {@code search_after}
*
* Adds one or more values to searchAfter
.
*/
public final Builder searchAfter(FieldValue value, FieldValue... values) {
this.searchAfter = _listAdd(this.searchAfter, value, values);
return this;
}
/**
* API name: {@code search_after}
*
* Adds all passed values to searchAfter
.
*/
public final Builder searchAfter(String value, String... values) {
this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value));
List fieldValues = new ArrayList<>();
for (String v : values) {
fieldValues.add(FieldValue.of(v));
}
this.searchAfter = _listAddAll(this.searchAfter, fieldValues);
return this;
}
/**
* API name: {@code search_after}
*
* Adds all passed values to searchAfter
.
*/
public final Builder searchAfter(long value, long... values) {
this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value));
List fieldValues = new ArrayList<>();
for (long v : values) {
fieldValues.add(FieldValue.of(v));
}
this.searchAfter = _listAddAll(this.searchAfter, fieldValues);
return this;
}
/**
* API name: {@code search_after}
*
* Adds all passed values to searchAfter
.
*/
public final Builder searchAfter(double value, double... values) {
this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value));
List fieldValues = new ArrayList<>();
for (double v : values) {
fieldValues.add(FieldValue.of(v));
}
this.searchAfter = _listAddAll(this.searchAfter, fieldValues);
return this;
}
/**
* API name: {@code search_after}
*
* Adds all passed values to searchAfter
.
*/
public final Builder searchAfter(boolean value, boolean... values) {
this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value));
List fieldValues = new ArrayList<>();
for (boolean v : values) {
fieldValues.add(FieldValue.of(v));
}
this.searchAfter = _listAddAll(this.searchAfter, fieldValues);
return this;
}
/**
* API name: {@code search_after}
*
* Adds a value to searchAfter
using a builder lambda.
*/
public final Builder searchAfter(Function> fn) {
return searchAfter(fn.apply(new FieldValue.Builder()).build());
}
/**
* API name: {@code search_type}
*/
public final Builder searchType(@Nullable SearchType value) {
this.searchType = value;
return this;
}
/**
* If true, returns sequence number and primary term of the last modification of
* each hit. See Optimistic concurrency control.
*
* API name: {@code seq_no_primary_term}
*/
public final Builder seqNoPrimaryTerm(@Nullable Boolean value) {
this.seqNoPrimaryTerm = value;
return this;
}
/**
* The number of hits to return. By default, you cannot page through more than
* 10,000 hits using the from and size parameters. To page through more hits,
* use the search_after parameter.
*
* API name: {@code size}
*/
public final Builder size(@Nullable Integer value) {
this.size = value;
return this;
}
/**
* API name: {@code slice}
*/
public final Builder slice(@Nullable SlicedScroll value) {
this.slice = value;
return this;
}
/**
* API name: {@code slice}
*/
public final Builder slice(Function> fn) {
return this.slice(fn.apply(new SlicedScroll.Builder()).build());
}
/**
* API name: {@code sort}
*
* Adds all elements of list
to sort
.
*/
public final Builder sort(List list) {
this.sort = _listAddAll(this.sort, list);
return this;
}
/**
* API name: {@code sort}
*
* Adds one or more values to sort
.
*/
public final Builder sort(SortOptions value, SortOptions... values) {
this.sort = _listAdd(this.sort, value, values);
return this;
}
/**
* API name: {@code sort}
*
* Adds a value to sort
using a builder lambda.
*/
public final Builder sort(Function> fn) {
return sort(fn.apply(new SortOptions.Builder()).build());
}
/**
* Stats groups to associate with the search. Each group maintains a statistics
* aggregation for its associated searches. You can retrieve these stats using
* the indices stats API.
*
* API name: {@code stats}
*
* Adds all elements of list
to stats
.
*/
public final Builder stats(List list) {
this.stats = _listAddAll(this.stats, list);
return this;
}
/**
* Stats groups to associate with the search. Each group maintains a statistics
* aggregation for its associated searches. You can retrieve these stats using
* the indices stats API.
*
* API name: {@code stats}
*
* Adds one or more values to stats
.
*/
public final Builder stats(String value, String... values) {
this.stats = _listAdd(this.stats, value, values);
return this;
}
/**
* List of stored fields to return as part of a hit. If no fields are specified,
* no stored fields are included in the response. If this field is specified,
* the _source parameter defaults to false. You can pass _source: true to return
* both source fields and stored fields in the search response.
*
* API name: {@code stored_fields}
*
* Adds all elements of list
to storedFields
.
*/
public final Builder storedFields(List list) {
this.storedFields = _listAddAll(this.storedFields, list);
return this;
}
/**
* List of stored fields to return as part of a hit. If no fields are specified,
* no stored fields are included in the response. If this field is specified,
* the _source parameter defaults to false. You can pass _source: true to return
* both source fields and stored fields in the search response.
*
* API name: {@code stored_fields}
*
* Adds one or more values to storedFields
.
*/
public final Builder storedFields(String value, String... values) {
this.storedFields = _listAdd(this.storedFields, value, values);
return this;
}
/**
* API name: {@code suggest}
*/
public final Builder suggest(@Nullable Suggester value) {
this.suggest = value;
return this;
}
/**
* API name: {@code suggest}
*/
public final Builder suggest(Function> fn) {
return this.suggest(fn.apply(new Suggester.Builder()).build());
}
/**
* Maximum number of documents to collect for each shard. If a query reaches
* this limit, Elasticsearch terminates the query early. Elasticsearch collects
* documents before sorting. Defaults to 0, which does not terminate query
* execution early.
*
* API name: {@code terminate_after}
*/
public final Builder terminateAfter(@Nullable Long value) {
this.terminateAfter = value;
return this;
}
/**
* Specifies the period of time to wait for a response from each shard. If no
* response is received before the timeout expires, the request fails and
* returns an error. Defaults to no timeout.
*
* API name: {@code timeout}
*/
public final Builder timeout(@Nullable String value) {
this.timeout = value;
return this;
}
/**
* If true, calculate and return document scores, even if the scores are not
* used for sorting.
*
* API name: {@code track_scores}
*/
public final Builder trackScores(@Nullable Boolean value) {
this.trackScores = value;
return this;
}
/**
* Number of hits matching the query to count accurately. If true, the exact
* number of hits is returned at the cost of some performance. If false, the
* response does not include the total number of hits matching the query.
* Defaults to 10,000 hits.
*
* API name: {@code track_total_hits}
*/
public final Builder trackTotalHits(@Nullable TrackHits value) {
this.trackTotalHits = value;
return this;
}
/**
* Number of hits matching the query to count accurately. If true, the exact
* number of hits is returned at the cost of some performance. If false, the
* response does not include the total number of hits matching the query.
* Defaults to 10,000 hits.
*
* API name: {@code track_total_hits}
*/
public final Builder trackTotalHits(Function> fn) {
return this.trackTotalHits(fn.apply(new TrackHits.Builder()).build());
}
/**
* If true, returns document version as part of a hit.
*
* API name: {@code version}
*/
public final Builder version(@Nullable Boolean value) {
this.version = value;
return this;
}
/**
* A comma separated list of checkpoints. When configured, the search API will
* only be executed on a shard after the relevant checkpoint has become visible
* for search. Defaults to an empty list which will cause Elasticsearch to
* immediately execute the search.
*
* API name: {@code wait_for_checkpoints}
*
* Adds all elements of list
to waitForCheckpoints
.
*/
public final Builder waitForCheckpoints(List list) {
this.waitForCheckpoints = _listAddAll(this.waitForCheckpoints, list);
return this;
}
/**
* A comma separated list of checkpoints. When configured, the search API will
* only be executed on a shard after the relevant checkpoint has become visible
* for search. Defaults to an empty list which will cause Elasticsearch to
* immediately execute the search.
*
* API name: {@code wait_for_checkpoints}
*
* Adds one or more values to waitForCheckpoints
.
*/
public final Builder waitForCheckpoints(Long value, Long... values) {
this.waitForCheckpoints = _listAdd(this.waitForCheckpoints, value, values);
return this;
}
@Override
protected Builder self() {
return this;
}
/**
* Builds a {@link FleetSearchRequest}.
*
* @throws NullPointerException
* if some of the required fields are null.
*/
public FleetSearchRequest build() {
_checkSingleUse();
return new FleetSearchRequest(this);
}
}
// ---------------------------------------------------------------------------------------------
/**
* Json deserializer for {@link FleetSearchRequest}
*/
public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer
.lazy(Builder::new, FleetSearchRequest::setupFleetSearchRequestDeserializer);
protected static void setupFleetSearchRequestDeserializer(ObjectDeserializer op) {
op.add(Builder::source, SourceConfig._DESERIALIZER, "_source");
op.add(Builder::aggregations, JsonpDeserializer.stringMapDeserializer(Aggregation._DESERIALIZER),
"aggregations", "aggs");
op.add(Builder::collapse, FieldCollapse._DESERIALIZER, "collapse");
op.add(Builder::docvalueFields, JsonpDeserializer.arrayDeserializer(FieldAndFormat._DESERIALIZER),
"docvalue_fields");
op.add(Builder::explain, JsonpDeserializer.booleanDeserializer(), "explain");
op.add(Builder::ext, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "ext");
op.add(Builder::fields, JsonpDeserializer.arrayDeserializer(FieldAndFormat._DESERIALIZER), "fields");
op.add(Builder::from, JsonpDeserializer.integerDeserializer(), "from");
op.add(Builder::highlight, Highlight._DESERIALIZER, "highlight");
op.add(Builder::indicesBoost,
JsonpDeserializer.arrayDeserializer(
JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.doubleDeserializer())),
"indices_boost");
op.add(Builder::minScore, JsonpDeserializer.doubleDeserializer(), "min_score");
op.add(Builder::pit, PointInTimeReference._DESERIALIZER, "pit");
op.add(Builder::postFilter, Query._DESERIALIZER, "post_filter");
op.add(Builder::profile, JsonpDeserializer.booleanDeserializer(), "profile");
op.add(Builder::query, Query._DESERIALIZER, "query");
op.add(Builder::rescore, JsonpDeserializer.arrayDeserializer(Rescore._DESERIALIZER), "rescore");
op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER),
"runtime_mappings");
op.add(Builder::scriptFields, JsonpDeserializer.stringMapDeserializer(ScriptField._DESERIALIZER),
"script_fields");
op.add(Builder::searchAfter, JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER), "search_after");
op.add(Builder::seqNoPrimaryTerm, JsonpDeserializer.booleanDeserializer(), "seq_no_primary_term");
op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size");
op.add(Builder::slice, SlicedScroll._DESERIALIZER, "slice");
op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort");
op.add(Builder::stats, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stats");
op.add(Builder::storedFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()),
"stored_fields");
op.add(Builder::suggest, Suggester._DESERIALIZER, "suggest");
op.add(Builder::terminateAfter, JsonpDeserializer.longDeserializer(), "terminate_after");
op.add(Builder::timeout, JsonpDeserializer.stringDeserializer(), "timeout");
op.add(Builder::trackScores, JsonpDeserializer.booleanDeserializer(), "track_scores");
op.add(Builder::trackTotalHits, TrackHits._DESERIALIZER, "track_total_hits");
op.add(Builder::version, JsonpDeserializer.booleanDeserializer(), "version");
}
// ---------------------------------------------------------------------------------------------
/**
* Endpoint "{@code fleet.search}".
*/
public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>("es/fleet.search",
// Request method
request -> {
return "POST";
},
// Request path
request -> {
final int _index = 1 << 0;
int propsSet = 0;
propsSet |= _index;
if (propsSet == (_index)) {
StringBuilder buf = new StringBuilder();
buf.append("/");
SimpleEndpoint.pathEncode(request.index, buf);
buf.append("/_fleet");
buf.append("/_fleet_search");
return buf.toString();
}
throw SimpleEndpoint.noPathTemplateFound("path");
},
// Path parameters
request -> {
Map params = new HashMap<>();
final int _index = 1 << 0;
int propsSet = 0;
propsSet |= _index;
if (propsSet == (_index)) {
params.put("index", request.index);
}
return params;
},
// Request parameters
request -> {
Map params = new HashMap<>();
params.put("typed_keys", "true");
if (request.df != null) {
params.put("df", request.df);
}
if (request.preFilterShardSize != null) {
params.put("pre_filter_shard_size", String.valueOf(request.preFilterShardSize));
}
if (request.minCompatibleShardNode != null) {
params.put("min_compatible_shard_node", request.minCompatibleShardNode);
}
if (request.lenient != null) {
params.put("lenient", String.valueOf(request.lenient));
}
if (request.routing != null) {
params.put("routing", request.routing);
}
if (request.ignoreUnavailable != null) {
params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable));
}
if (request.allowNoIndices != null) {
params.put("allow_no_indices", String.valueOf(request.allowNoIndices));
}
if (request.analyzer != null) {
params.put("analyzer", request.analyzer);
}
if (request.ignoreThrottled != null) {
params.put("ignore_throttled", String.valueOf(request.ignoreThrottled));
}
if (request.maxConcurrentShardRequests != null) {
params.put("max_concurrent_shard_requests", String.valueOf(request.maxConcurrentShardRequests));
}
if (request.allowPartialSearchResults != null) {
params.put("allow_partial_search_results", String.valueOf(request.allowPartialSearchResults));
}
if (ApiTypeHelper.isDefined(request.expandWildcards)) {
params.put("expand_wildcards",
request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(",")));
}
if (request.preference != null) {
params.put("preference", request.preference);
}
if (request.analyzeWildcard != null) {
params.put("analyze_wildcard", String.valueOf(request.analyzeWildcard));
}
if (request.scroll != null) {
params.put("scroll", request.scroll._toJsonString());
}
if (request.searchType != null) {
params.put("search_type", request.searchType.jsonValue());
}
if (request.ccsMinimizeRoundtrips != null) {
params.put("ccs_minimize_roundtrips", String.valueOf(request.ccsMinimizeRoundtrips));
}
if (request.q != null) {
params.put("q", request.q);
}
if (request.defaultOperator != null) {
params.put("default_operator", request.defaultOperator.jsonValue());
}
if (request.requestCache != null) {
params.put("request_cache", String.valueOf(request.requestCache));
}
if (ApiTypeHelper.isDefined(request.waitForCheckpoints)) {
params.put("wait_for_checkpoints", request.waitForCheckpoints.stream().map(v -> String.valueOf(v))
.collect(Collectors.joining(",")));
}
if (request.batchedReduceSize != null) {
params.put("batched_reduce_size", String.valueOf(request.batchedReduceSize));
}
return params;
}, SimpleEndpoint.emptyMap(), true, FleetSearchResponse._DESERIALIZER);
/**
* Create an "{@code fleet.search}" endpoint.
*/
public static Endpoint, ErrorResponse> createSearchEndpoint(
JsonpDeserializer tDocumentDeserializer) {
return _ENDPOINT.withResponseDeserializer(
FleetSearchResponse.createFleetSearchResponseDeserializer(tDocumentDeserializer));
}
}