Skip to content
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

[ML] Use indices options in anomaly detection job wizards #91830

Merged
merged 18 commits into from
Mar 16, 2021

Conversation

jgowdyelastic
Copy link
Member

@jgowdyelastic jgowdyelastic commented Feb 18, 2021

In the advanced job wizard, it is now possible to add indices_options to the datafeed, and will now be used for all searches performed during the job creation UI process (e.g. the datafeed preview, loading the start and end times for the index, bucket span and model memory estimation)

Moves the datafeed preview function to the server side, behind the endpoint /api/ml/jobs/datafeed_preview

Also updates the JSON editor save function to recalculate the start and end times for the index which is used for all searches. The start and end times of the index are loaded when the wizard opens, but after a datafeed change these times may now be incorrect or the original times may have been incorrect if there was a problem with the search (e.g. a problem with CCS)

Closes #91983

-- edit

For indices/data streams, doing a ccs search via *:my-index requires that my-index exists on all remote clusters being queried. If my-index is missing in one of the remote clusters then the index_not_found_exception error is returned. Unless ignore_unavailable is set to true.

@jgowdyelastic
Copy link
Member Author

@elasticmachine merge upstream

@jgowdyelastic jgowdyelastic changed the title [ML] WIP Datafeed preview refactor [ML] WIP Use indices options in anomaly detection job wizards Mar 2, 2021
@jgowdyelastic
Copy link
Member Author

@elasticmachine merge upstream

@jgowdyelastic
Copy link
Member Author

@elasticmachine merge upstream

@jgowdyelastic
Copy link
Member Author

@elasticmachine merge upstream

@jgowdyelastic jgowdyelastic changed the title [ML] WIP Use indices options in anomaly detection job wizards [ML] Use indices options in anomaly detection job wizards Mar 11, 2021
@jgowdyelastic jgowdyelastic marked this pull request as ready for review March 11, 2021 16:40
@jgowdyelastic jgowdyelastic requested a review from a team as a code owner March 11, 2021 16:40
@jgowdyelastic jgowdyelastic self-assigned this Mar 11, 2021
@jgowdyelastic jgowdyelastic added :ml auto-backport Deprecated - use backport:version if exact versions are needed Feature:Anomaly Detection ML anomaly detection release_note:fix review v7.13.0 v8.0.0 labels Mar 11, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@jgowdyelastic
Copy link
Member Author

@elasticmachine merge upstream

@peteharverson
Copy link
Contributor

Testing locally, I create a job in the advanced wizard and set indices_options in the datafeed JSON (attempting to use "ignore_unavailable": true,)

{
  "datafeed_id": "datafeed-fq_advanced",
  "job_id": "fq_advanced",
  "indices": [
    "farequote-2019"
  ],
  "indices_options": {
    "expand_wildcards": [
      "open"
    ],
    "ignore_unavailable": true,
    "allow_no_indices": true,
    "ignore_throttled": true
  },
  "query": {
    "bool": {
      "must": [
        {
          "match_all": {}
        }
      ]
    }
  }
}

and when I hit Estimate bucket span, I see this error, which implies the wrong arguments are getting sent for runtime_mappings in one of the calls:

image

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested latest edit and LGTM

@@ -548,7 +551,9 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) {
aggFieldNamePairs,
splitFieldName,
splitFieldValue,
runtimeMappings
runtimeMappings,

Copy link
Member

Choose a reason for hiding this comment

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

Should we get rid of this extra line?

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -603,7 +609,9 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) {
query,
aggFieldNamePairs,
splitFieldName,
runtimeMappings
runtimeMappings,

Copy link
Member

Choose a reason for hiding this comment

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

Same for this extra line here as well

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -29,4 +29,6 @@ export const getTimeFieldRangeSchema = schema.object({
timeFieldName: schema.maybe(schema.string()),
/** Query to match documents in the index(es). */
query: schema.maybe(schema.any()),
/** Additional search options. */
indicesOptions: schema.maybe(schema.any()),
Copy link
Member

Choose a reason for hiding this comment

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

Since this indicesOptions is used in a lot of end points, should we define the schema for it?

Copy link
Member Author

Choose a reason for hiding this comment

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

@qn895
Copy link
Member

qn895 commented Mar 16, 2021

LGTM. Just had a few minor comments about the extra lines and indicesOptions schema.

@jgowdyelastic jgowdyelastic merged commit 4914acc into elastic:master Mar 16, 2021
@jgowdyelastic jgowdyelastic deleted the datafeed-preview-refactor branch March 16, 2021 19:55
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Mar 16, 2021
)

* [ML] WIP Datafeed preview refactor

* adding indices options to ad job creation searches

* update datafeed preview schema

* updating types

* recalculating wizard time range on JSON edit save

* updating endpoint docs

* fixing types

* more type fixes

* fixing missing runtime fields

* using isPopulatedObject

* adding indices options schema

* fixing test

* fixing schema

Co-authored-by: Kibana Machine <[email protected]>
@kibanamachine
Copy link
Contributor

💚 Backport successful

7.x / #94755

Successful backport PRs will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Mar 16, 2021
…94755)

* [ML] WIP Datafeed preview refactor

* adding indices options to ad job creation searches

* update datafeed preview schema

* updating types

* recalculating wizard time range on JSON edit save

* updating endpoint docs

* fixing types

* more type fixes

* fixing missing runtime fields

* using isPopulatedObject

* adding indices options schema

* fixing test

* fixing schema

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: James Gowdy <[email protected]>
jloleysens added a commit that referenced this pull request Mar 17, 2021
…-action

* 'master' of github.com:elastic/kibana: (44 commits)
  Migrate the optimizer mixin to core (#94272)
  Replace EuiCodeBlock with JsonCodeEditor in DiscoverGrid (#92442)
  [ML] Anomaly Detection: Migrate validation messages links to use docLinks. (#94568)
  [Lists][Exceptions] - Adding basic linting, i18n and storybook support (#94772)
  [Fleet] Add test/fix for invalid/missing ids in bulk agent reassign (#94632)
  [Security Solution] [Cases] Move create page components and dependencies to Cases (#94444)
  [ML] Data Frame Analytics accessibility tests: fix flaky outlier creation test (#94735)
  [Security Solutions] Remove commented out old linter rules (#94753)
  [App Search] Role mappings migration part 2 (#94461)
  [CI] Update Backport action inputs to match updated ones (#94721)
  [chore] Remove the infra team from CODEOWNERS (#94740)
  [Connectors UI] Make UI use new connector APIs (#94180)
  [ML] Use indices options in anomaly detection job wizards (#91830)
  Remove `string` as a valid registry var type value (#94174)
  [Alerts] Replaces legacy es client with the ElasticsearchClient for alerts and triggers_actions_ui plugins. (#93364)
  [Reporting-CSV Export] Re-write CSV Export using SearchSource (#88303)
  chore(NA): upgrade bazel rules nodejs to v3.2.2 (#94726)
  [APM] Settings: Update layout and update/add descriptions (#94398)
  skip flaky suite (#94666)
  [XY axis] Integrates legend color picker with the eui palette (#90589)
  ...

# Conflicts:
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/cold_phase/cold_phase.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/searchable_snapshot_field/searchable_snapshot_field.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/constants.ts
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/configuration_context.tsx
#	x-pack/plugins/index_lifecycle_management/public/shared_imports.ts
@kibanamachine
Copy link
Contributor

kibanamachine commented May 26, 2021

💔 Build Failed

Failed CI Steps

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [ed5bbda]

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jgowdyelastic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Anomaly Detection ML anomaly detection :ml release_note:enhancement review v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ML] Advanced wizard should handle datafeed indices_options correctly
5 participants