Skip to content

ML: changing JobResultsProvider.getForecastRequestStats to support > 1 index#37157

Merged
benwtrent merged 2 commits intoelastic:masterfrom
benwtrent:feature/support-multi-indices-job-results
Jan 7, 2019
Merged

ML: changing JobResultsProvider.getForecastRequestStats to support > 1 index#37157
benwtrent merged 2 commits intoelastic:masterfrom
benwtrent:feature/support-multi-indices-job-results

Conversation

@benwtrent
Copy link
Copy Markdown
Member

Blocker for #36643

This is the only place where I could find us using a GetRequest against the results indices. Once we help users migrate the results indices, there will be more than one index behind the job aliased index.

@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/ml-core

@benwtrent
Copy link
Copy Markdown
Member Author

run gradle build tests 1

.execute().actionGet();
SearchResponse searchResponse = client().prepareSearch(AnomalyDetectorsIndex.jobResultsAliasedName(jobId))
.setQuery(new BoolQueryBuilder()
.filter(new TermQueryBuilder("_id", ForecastRequestStats.documentId(jobId, forecastId))))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use an IdsQueryBuilder instead of the TermQueryBuilder and drop the BoolQueryBuilder

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidkyle TIL :D.

SearchRequestBuilder forecastSearch = client.prepareSearch(indexName)
.setTypes(ElasticsearchMappings.DOC_TYPE)
.setQuery(new BoolQueryBuilder()
.filter(new TermQueryBuilder("_id",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

Copy link
Copy Markdown
Member

@davidkyle davidkyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benwtrent
Copy link
Copy Markdown
Member Author

run gradle build tests 1

1 similar comment
@benwtrent
Copy link
Copy Markdown
Member Author

run gradle build tests 1

@benwtrent benwtrent merged commit 1780ced into elastic:master Jan 7, 2019
@benwtrent benwtrent deleted the feature/support-multi-indices-job-results branch January 7, 2019 16:59
benwtrent added a commit that referenced this pull request Jan 7, 2019
…1 index (#37157)

* ML: changing JobResultsProvider.getForecastRequestStats to support more than one index

* moving to use idsQuery()
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Jan 7, 2019
…piration

* elastic/master:
  Removing unused methods in Numbers (elastic#37186)
  Fix setting by time unit (elastic#37192)
  [DOCS] Cleans up xpackml attributes
  ML: fix delayed data annotations on secured cluster (elastic#37193)
  Update version in SearchRequest and related test
  [DOCS] Adds overview and API ref for cluster voting configurations (elastic#36954)
  ML: changing JobResultsProvider.getForecastRequestStats to support > 1 index (elastic#37157)
  Separate out validation of groups of settings (elastic#34184)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants