-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[ML] Create the ml-config index #36608
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
davidkyle
wants to merge
12
commits into
elastic:feature-jindex-6x
from
davidkyle:jindex-create-index
Closed
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
94402e4
Create the ml-config index
davidkyle 438079e
Set results window size in template
davidkyle b74af10
Adjust after rebase
davidkyle f4a300e
create once
davidkyle 172981d
Create the index only if there are configs to migrate
davidkyle 57cabfb
Update on all changes
davidkyle a3e9a6d
Tidy up assignment notifier
davidkyle f3c70b1
Use the config index max results window size in searches
davidkyle ade9b2d
Remove unnecessary atomicboolean
davidkyle 3d2b0d6
Add test for index creation
davidkyle 3f607d7
Adjust to rebase
davidkyle b5c4243
Move setting
davidkyle 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,6 +53,7 @@ | |
| import org.elasticsearch.xpack.core.ml.job.persistence.ElasticsearchMappings; | ||
| import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper; | ||
| import org.elasticsearch.xpack.core.ml.utils.ToXContentParams; | ||
| import org.elasticsearch.xpack.ml.MlConfigMigrator; | ||
| import org.elasticsearch.xpack.ml.job.persistence.ExpandedIdsMatcher; | ||
|
|
||
| import java.io.IOException; | ||
|
|
@@ -73,6 +74,15 @@ | |
| import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN; | ||
| import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; | ||
|
|
||
| /** | ||
| * This class implements CRUD operation for the | ||
| * datafeed configuration document | ||
| * | ||
| * The number of datafeeds returned in a search it limited to | ||
| * {@link MlConfigMigrator#CONFIG_INDEX_MAX_RESULTS_WINDOW}. | ||
|
||
| * In most cases we expect 10s or 100s of datafeeds to be defined and | ||
| * a search for all datafeeds should return all. | ||
| */ | ||
| public class DatafeedConfigProvider { | ||
|
|
||
| private static final Logger logger = LogManager.getLogger(DatafeedConfigProvider.class); | ||
|
|
@@ -88,13 +98,6 @@ public class DatafeedConfigProvider { | |
| TO_XCONTENT_PARAMS = Collections.unmodifiableMap(modifiable); | ||
| } | ||
|
|
||
| /** | ||
| * In most cases we expect 10s or 100s of datafeeds to be defined and | ||
| * a search for all datafeeds should return all. | ||
| * TODO this is a temporary fix | ||
| */ | ||
| public int searchSize = 1000; | ||
|
|
||
| public DatafeedConfigProvider(Client client, NamedXContentRegistry xContentRegistry) { | ||
| this.client = client; | ||
| this.xContentRegistry = xContentRegistry; | ||
|
|
@@ -433,7 +436,7 @@ private SearchRequest buildExpandDatafeedIdsSearch(String expression) { | |
| return client.prepareSearch(AnomalyDetectorsIndex.configIndexName()) | ||
| .setIndicesOptions(IndicesOptions.lenientExpandOpen()) | ||
| .setSource(sourceBuilder) | ||
| .setSize(searchSize) | ||
| .setSize(MlConfigMigrator.CONFIG_INDEX_MAX_RESULTS_WINDOW) | ||
| .request(); | ||
| } | ||
|
|
||
|
|
@@ -458,7 +461,7 @@ public void expandDatafeedConfigs(String expression, boolean allowNoDatafeeds, A | |
| SearchRequest searchRequest = client.prepareSearch(AnomalyDetectorsIndex.configIndexName()) | ||
| .setIndicesOptions(IndicesOptions.lenientExpandOpen()) | ||
| .setSource(sourceBuilder) | ||
| .setSize(searchSize) | ||
| .setSize(MlConfigMigrator.CONFIG_INDEX_MAX_RESULTS_WINDOW) | ||
| .request(); | ||
|
|
||
| ExpandedIdsMatcher requiredMatches = new ExpandedIdsMatcher(tokens, allowNoDatafeeds); | ||
|
|
@@ -514,7 +517,7 @@ public void expandDatafeedConfigsWithoutMissingCheck(String expression, ActionLi | |
| SearchRequest searchRequest = client.prepareSearch(AnomalyDetectorsIndex.configIndexName()) | ||
| .setIndicesOptions(IndicesOptions.lenientExpandOpen()) | ||
| .setSource(sourceBuilder) | ||
| .setSize(searchSize) | ||
| .setSize(MlConfigMigrator.CONFIG_INDEX_MAX_RESULTS_WINDOW) | ||
| .request(); | ||
|
|
||
| executeAsyncWithOrigin(client.threadPool().getThreadContext(), ML_ORIGIN, searchRequest, | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This setting is misplaced here. Could you move it to
AnomalyDetectorsIndexplease?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we should take the chance and raise this to 100K?