-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Enable Shard-Level Search-load rate metric #128660
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
Merged
drempapis
merged 55 commits into
elastic:main
from
drempapis:search_load_per_index_multiproject
Jun 11, 2025
Merged
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
e0b4e4b
Calculate search load per shard in multiproject env
drempapis 6d9b8bf
export package for transport action
drempapis 2d9b8b6
merge main
drempapis c058a33
update transport version
drempapis 254f739
Merge branch 'main' into search_load_per_index_multiproject
drempapis 6614cf9
update license headers
drempapis 20574d4
Merge branch 'search_load_per_index_multiproject' of github.com:dremp…
drempapis aa0c5b2
[CI] Auto commit changes from spotless
c8fb560
Register action name in constants
drempapis 062fb9f
Merge branch 'main' into search_load_per_index_multiproject
drempapis 182f3b6
update after review
drempapis 0c7bf62
Merge branch 'main' into search_load_per_index_multiproject
drempapis 102bdc1
Removing the allocationId
drempapis 31b63b0
[CI] Auto commit changes from spotless
76d1540
merge main and update after review
drempapis 695d57b
update after review
drempapis b276035
update after review
drempapis 6e73c2e
remove stale package from .info file
drempapis ebb6ed0
Merge branch 'main' into search_load_per_index_multiproject
drempapis 7cfec46
update after review
drempapis 2f3597b
Merge branch 'main' into search_load_per_index_multiproject
drempapis d7fab3b
merge main
drempapis 8f5ea6b
Merge branch 'main' into search_load_per_index_multiproject
drempapis 73d93a5
update after review
drempapis 8f36172
update after review
drempapis bf6ae86
merge main and resolve conflicts
drempapis 8b1f24d
add brief documentation for searchLoad
drempapis 7c16279
[CI] Auto commit changes from spotless
91ef808
Added yaml file for the search load / shard level
drempapis 02100c2
Merge branch 'search_load_per_index_multiproject' of github.com:dremp…
drempapis ca429e6
Merge branch 'main' into search_load_per_index_multiproject
drempapis 06145ee
Merge branch 'main' into search_load_per_index_multiproject
drempapis bd9c5ea
Merge branch 'main' into search_load_per_index_multiproject
drempapis 30ad337
update after review
drempapis c7b322a
Update server/src/main/java/org/elasticsearch/index/search/stats/Sear…
drempapis 877c62e
update after review
drempapis 6ced664
Merge branch 'search_load_per_index_multiproject' of github.com:dremp…
drempapis 011e654
[CI] Auto commit changes from spotless
17b5611
update after review
drempapis a43ae30
Merge branch 'search_load_per_index_multiproject' of github.com:dremp…
drempapis 56ce7b0
merge main to branch
drempapis 0a3ab4c
merge main
drempapis 7af8949
Merge branch 'main' into search_load_per_index_multiproject
drempapis 34d7b6d
Update after review
drempapis cb1088a
Merge branch 'search_load_per_index_multiproject' of github.com:dremp…
drempapis e4e82f7
[CI] Auto commit changes from spotless
5efd07a
Merge branch 'main' into search_load_per_index_multiproject
drempapis 7c0462e
Merge branch 'main' into search_load_per_index_multiproject
drempapis ccd37ba
Merge branch 'main' into search_load_per_index_multiproject
drempapis d5e2751
Merge branch 'main' into search_load_per_index_multiproject
drempapis eeb558d
Merge branch 'main' into search_load_per_index_multiproject
drempapis cb48991
Update for serverless checks
drempapis 5bb7b9e
Merge branch 'main' into search_load_per_index_multiproject
drempapis b439f89
Merge branch 'main' into search_load_per_index_multiproject
drempapis 8f30723
Merge branch 'main' into search_load_per_index_multiproject
drempapis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.stats/80_search_load.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
setup: | ||
- requires: | ||
cluster_features: ["mapper.search_load_per_shard"] | ||
reason: Shard search load stats were introduced in 9.1 | ||
--- | ||
"Search load is tracked at shard level": | ||
- do: | ||
indices.create: | ||
index: index | ||
body: | ||
mappings: | ||
properties: | ||
name: | ||
type: text | ||
description: | ||
type: text | ||
price: | ||
type: double | ||
|
||
- do: | ||
indices.stats: | ||
index: "index" | ||
level: shards | ||
metric: [ search ] | ||
|
||
- match: { _all.total.search.recent_search_load: 0.0 } | ||
- match: { indices.index.total.search.recent_search_load: 0.0 } | ||
- match: { indices.index.shards.0.0.search.recent_search_load: 0.0 } | ||
|
||
- do: | ||
index: | ||
index: index | ||
body: { "name": "specialty coffee", "description": "arabica coffee beans", "price": 100 } | ||
|
||
- do: | ||
search: | ||
index: index | ||
body: | ||
query: | ||
match: { name: "specialty coffee" } | ||
size: 1 | ||
|
||
- do: | ||
indices.stats: | ||
index: "index" | ||
level: shards | ||
metric: [ search ] | ||
|
||
- gte: { _all.total.search.recent_search_load: 0.0 } | ||
- gte: { indices.index.total.search.recent_search_load: 0.0 } | ||
- gte: { indices.index.shards.0.0.search.recent_search_load: 0.0 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
server/src/main/java/org/elasticsearch/index/search/stats/SearchStatsSettings.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.index.search.stats; | ||
|
||
import org.elasticsearch.common.settings.ClusterSettings; | ||
import org.elasticsearch.common.settings.Setting; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.core.TimeValue; | ||
|
||
/** | ||
* Container for cluster settings | ||
*/ | ||
public class SearchStatsSettings { | ||
|
||
public static final TimeValue RECENT_READ_LOAD_HALF_LIFE_DEFAULT = TimeValue.timeValueMinutes(5); | ||
static final TimeValue RECENT_READ_LOAD_HALF_LIFE_MIN = TimeValue.timeValueSeconds(1); // A sub-second half-life makes no sense | ||
static final TimeValue RECENT_READ_LOAD_HALF_LIFE_MAX = TimeValue.timeValueDays(100_000); // Long.MAX_VALUE nanos, rounded down | ||
|
||
/** | ||
* A cluster setting giving the half-life, in seconds, to use for the Exponentially Weighted Moving Rate calculation used for the | ||
* recency-weighted read load | ||
* | ||
* <p>This is dynamic, but changes only apply to newly-opened shards. | ||
*/ | ||
public static final Setting<TimeValue> RECENT_READ_LOAD_HALF_LIFE_SETTING = Setting.timeSetting( | ||
"indices.stats.recent_read_load.half_life", | ||
RECENT_READ_LOAD_HALF_LIFE_DEFAULT, | ||
RECENT_READ_LOAD_HALF_LIFE_MIN, | ||
RECENT_READ_LOAD_HALF_LIFE_MAX, | ||
Setting.Property.Dynamic, | ||
Setting.Property.NodeScope | ||
); | ||
|
||
private volatile TimeValue recentReadLoadHalfLifeForNewShards = RECENT_READ_LOAD_HALF_LIFE_SETTING.getDefault(Settings.EMPTY); | ||
|
||
public SearchStatsSettings(ClusterSettings clusterSettings) { | ||
clusterSettings.initializeAndWatch(RECENT_READ_LOAD_HALF_LIFE_SETTING, value -> recentReadLoadHalfLifeForNewShards = value); | ||
} | ||
|
||
public TimeValue getRecentReadLoadHalfLifeForNewShards() { | ||
return recentReadLoadHalfLifeForNewShards; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.