Skip to content

Cumulative 7.x backport #43082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions docs/reference/search.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,11 @@ configure a soft limit, you can update the `action.search.shard_count.limit`
cluster setting in order to reject search requests that hit too many shards.

The request parameter `max_concurrent_shard_requests` can be used to control the
maximum number of concurrent shard requests the search API will execute for the
request. This parameter should be used to protect a single request from
maximum number of concurrent shard requests the search API will execute per node
for the request. This parameter should be used to protect a single request from
overloading a cluster (e.g., a default request will hit all indices in a cluster
which could cause shard request rejections if the number of shards per node is
high). This default is based on the number of data nodes in the cluster but at
most `256`.
high). This default value is `5`.

--

Expand Down
19 changes: 10 additions & 9 deletions docs/reference/search/multi-search.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,16 @@ The msearch's `max_concurrent_searches` request parameter can be used to control
the maximum number of concurrent searches the multi search api will execute.
This default is based on the number of data nodes and the default search thread pool size.

The request parameter `max_concurrent_shard_requests` can be used to control the
maximum number of concurrent shard requests the each sub search request will execute.
This parameter should be used to protect a single request from overloading a cluster
(e.g., a default request will hit all indices in a cluster which could cause shard request rejections
if the number of shards per node is high). This default is based on the number of
data nodes in the cluster but at most `256`.In certain scenarios parallelism isn't achieved through
concurrent request such that this protection will result in poor performance. For
instance in an environment where only a very low number of concurrent search requests are expected
it might help to increase this value to a higher number.
The request parameter `max_concurrent_shard_requests` can be used to control
the maximum number of concurrent shard requests that each sub search request
will execute per node. This parameter should be used to protect a single
request from overloading a cluster (e.g., a default request will hit all
indices in a cluster which could cause shard request rejections if the number
of shards per node is high). This default value is `5`.In certain scenarios
parallelism isn't achieved through concurrent request such that this protection
will result in poor performance. For instance in an environment where only a
very low number of concurrent search requests are expected it might help to
increase this value to a higher number.

[float]
[[msearch-security]]
Expand Down
27 changes: 26 additions & 1 deletion docs/reference/search/suggesters/phrase-suggest.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,10 @@ POST _search

The `phrase` suggester supports multiple smoothing models to balance
weight between infrequent grams (grams (shingles) are not existing in
the index) and frequent grams (appear at least once in the index).
the index) and frequent grams (appear at least once in the index). The
smoothing model can be selected by setting the `smoothing` parameter
to one of the following options. Each smoothing model supports specific
properties that can be configured.

[horizontal]
`stupid_backoff`::
Expand All @@ -288,6 +291,28 @@ the index) and frequent grams (appear at least once in the index).
All parameters (`trigram_lambda`, `bigram_lambda`, `unigram_lambda`)
must be supplied.

[source,js]
--------------------------------------------------
POST _search
{
"suggest": {
"text" : "obel prize",
"simple_phrase" : {
"phrase" : {
"field" : "title.trigram",
"size" : 1,
"smoothing" : {
"laplace" : {
"alpha" : 0.7
}
}
}
}
}
}
--------------------------------------------------
// CONSOLE

==== Candidate Generators

The `phrase` suggester uses candidate generators to produce a list of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
},
"max_concurrent_shard_requests" : {
"type" : "number",
"description" : "The number of concurrent shard requests each sub search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests",
"default" : "The default grows with the number of nodes in the cluster but is at most 256."
"description" : "The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests",
"default" : 5
},
"rest_total_hits_as_int" : {
"type" : "boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
"max_concurrent_shard_requests" : {
"type" : "number",
"description" : "The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests",
"default" : "The default is 5."
"default" : 5
},
"pre_filter_shard_size" : {
"type" : "number",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ public SearchRequest(String[] indices, SearchSourceBuilder source) {
}

/**
* Creates a new search request by providing the search request to copy all fields from, the indices to search against, the alias of
* the cluster where it will be executed, as well as the start time in milliseconds from the epoch time and whether the reduction
* should be final or not. Used when a {@link SearchRequest} is created and executed as part of a cross-cluster search request
* Creates a new sub-search request starting from the original search request that is provided.
* For internal use only, allows to fork a search request into multiple search requests that will be executed independently.
* Such requests will not be finally reduced, so that their results can be merged together in one response at completion.
* Used when a {@link SearchRequest} is created and executed as part of a cross-cluster search request
* performing reduction on each cluster in order to minimize network round-trips between the coordinating node and the remote clusters.
*
* @param originalSearchRequest the original search request
Expand All @@ -146,8 +147,8 @@ public SearchRequest(String[] indices, SearchSourceBuilder source) {
* @param absoluteStartMillis the absolute start time to be used on the remote clusters to ensure that the same value is used
* @param finalReduce whether the reduction should be final or not
*/
static SearchRequest crossClusterSearch(SearchRequest originalSearchRequest, String[] indices,
String clusterAlias, long absoluteStartMillis, boolean finalReduce) {
static SearchRequest subSearchRequest(SearchRequest originalSearchRequest, String[] indices,
String clusterAlias, long absoluteStartMillis, boolean finalReduce) {
Objects.requireNonNull(originalSearchRequest, "search request must not be null");
validateIndices(indices);
Objects.requireNonNull(clusterAlias, "cluster alias must not be null");
Expand Down Expand Up @@ -300,15 +301,15 @@ boolean isFinalReduce() {
/**
* Returns the current time in milliseconds from the time epoch, to be used for the execution of this search request. Used to
* ensure that the same value, determined by the coordinating node, is used on all nodes involved in the execution of the search
* request. When created through {@link #crossClusterSearch(SearchRequest, String[], String, long, boolean)}, this method returns
* request. When created through {@link #subSearchRequest(SearchRequest, String[], String, long, boolean)}, this method returns
* the provided current time, otherwise it will return {@link System#currentTimeMillis()}.
*/
long getOrCreateAbsoluteStartMillis() {
return absoluteStartMillis == DEFAULT_ABSOLUTE_START_MILLIS ? System.currentTimeMillis() : absoluteStartMillis;
}

/**
* Returns the provided <code>absoluteStartMillis</code> when created through {@link #crossClusterSearch} and
* Returns the provided <code>absoluteStartMillis</code> when created through {@link #subSearchRequest} and
* -1 otherwise.
*/
long getAbsoluteStartMillis() {
Expand Down
Loading