kibana/x-pack/plugins/ml
Quynh Nguyen 747212ce45
[ML] Add KQL filter bar, filtering functionality, and compact design to Index data visualizer (#112870)
* [ML] Initial embed

* [ML] Initial embed props

* [ML] Add top nav link to data viz

* Add visible fields

* Add add data service to register links

* Renames, refactor, use constants

* Renames, refactor, use constants

* Update tests and mocks

* Embeddable

* Update hook to update upon time udpate

* Add filter support to query

* Refactor filter utilities

* Add filter support for embeddable

* Fix saved search data undefined

* Prototype aggregated view/document view switcher

* Prototype flyout

* Prototype save document view option in storage

* Fix filter and query conflict with saved search

* Minor styling edits

* [ML] Update functional tests to reflect new arrow icons

* [ML] Add filter buttons and KQL bars

* [ML] Update filter bar onChange behavior

* [ML] Update top values filter onChange behavior

* [ML] Update search filters when opening saved search

* [ML] Clean up

* [ML] Remove fit content for height

* [ML] Fix boolean legend

* [ML] Fix header section when browser width is small to large and when index pattern title is too large

* [ML] Hide expander icon when dimension is xs or s & css fixes

* [ML] Delete embeddables because they are not use

* [ML] Make doc count 0 for empty fields, update t/f test

* [ML] Add unit testing for search utils

* [ML] No need to - padding

* [ML] Fix expand all/collapse all behavior to override individual setting

* [ML] Fix functional tests should be 0/0%

* [ML] Fix docs content spacing, rename classnames, add filters to Discover, lens, and maps

* [ML] Fix icon styling to match Discover but have text/keyword/histogram

* [ML] Fix filters not persisting after page refresh & on query change

* [ML] Rename classnames to BEM style

* [ML] Fix doc count for fields that exists but have no stats

* [ML] Clean up unused styles

* [ML] Fix eui var & icon & file geo

* [ML] Fix navigating to Lens from new saved search broken

* [ML] Change types back to Index pattern for 7.16

* [ML] Update not in docs content and snapshots

* [ML] Fix Lens and indexRefName

* [ML] Fix field icon and texts not aligned, remove span because EuiToolTip now supports EuiToken

* [ML] Fix data view
2021-09-30 11:37:56 -05:00
..
__mocks__
common [DX] Upgrade prettier to v2.4.0 (#112359) 2021-09-19 22:34:30 -07:00
public [ML] Add KQL filter bar, filtering functionality, and compact design to Index data visualizer (#112870) 2021-09-30 11:37:56 -05:00
server [ML] Convert APM transaction anomaly detection job to analyze metric data (#111957) 2021-09-29 17:52:00 +01:00
.gitignore [ML] Add job audit messages API integration tests (#110793) 2021-09-02 14:43:14 +02:00
jest.config.js [jest] update config files to get coverage per plugin (#111299) 2021-09-09 08:14:56 +02:00
kibana.json [ML] Fix date formatting in the alert context of the Anomaly detection job health rule type (#109073) 2021-08-19 13:42:06 +02:00
package.json [ML] Update API docs generation script to comply with new docs format (#109343) 2021-08-24 10:03:37 +02:00
readme.md
shared_imports.ts
tsconfig.json [build_ts_refs] improve caches, allow building a subset of projects (#107981) 2021-08-10 22:12:45 -07:00

Documentation for ML UI developers

This plugin provides access to the machine learning features provided by Elastic.

Requirements

To use machine learning features, you must have a Platinum or Enterprise license or a free 14-day Trial. File Data Visualizer requires a Basic license. For more info, refer to Set up machine learning features.

Setup local environment

Kibana

  1. Fork and clone the Kibana repo.

  2. Install nvm, node, yarn (for example, by using Homebrew). See Install dependencies.

  3. Make sure that Elasticsearch is deployed and running on localhost:9200.

  4. Navigate to the directory of the kibana repository on your machine.

  5. Fetch the latest changes from the repository.

  6. Checkout the branch of the version you want to use. For example, if you want to use a 7.9 version, run git checkout 7.9.

  7. Run nvm use. The response shows the Node version that the environment uses. If you need to update your Node version, the response message contains the command you need to run to do it.

  8. Run yarn kbn bootstrap. It takes all the dependencies in the code and installs/checks them. It is recommended to use it every time when you switch between branches.

  9. Make a copy of kibana.yml and save as kibana.dev.yml. (Git will not track the changes in kibana.dev.yml but yarn will use it.)

  10. Provide the appropriate password and user name in kibana.dev.yml.

  11. Run yarn start to start Kibana.

  12. Go to http://localhost:560x/xxx (check the terminal message for the exact path).

For more details, refer to this getting started page.

Adding sample data to Kibana

Kibana has sample data sets that you can add to your setup so that you can test different configurations on sample data.

  1. Click the Elastic logo in the upper left hand corner of your browser to navigate to the Kibana home page.

  2. Click Load a data set and a Kibana dashboard.

  3. Pick a data set or feel free to click Add on all of the available sample data sets.

These data sets are now ready be analyzed in ML jobs in Kibana.

Running tests

Jest tests

Documentation: https://www.elastic.co/guide/en/kibana/current/development-tests.html#_unit_testing

Run the test following jest tests from kibana/x-pack/plugins/ml.

New snapshots, all plugins:

yarn test:jest

Update snapshots for the ML plugin:

yarn test:jest -u

Update snapshots for a specific directory only:

yarn test:jest public/application/settings/filter_lists

Run tests with verbose output:

yarn test:jest --verbose

Functional tests

Before running the test server, make sure to quit all other instances of Elasticsearch.

Run the following commands from the x-pack directory and use separate terminals for test server and test runner. The test server command starts an Elasticsearch and Kibana instance that the tests will be run against.

  1. Functional UI tests with Trial license (default config):

    node scripts/functional_tests_server.js
    node scripts/functional_test_runner.js --include-tag mlqa
    

    ML functional Trial license tests are located in x-pack/test/functional/apps/ml.

  2. Functional UI tests with Basic license:

    node scripts/functional_tests_server.js --config test/functional_basic/config.ts
    node scripts/functional_test_runner.js --config test/functional_basic/config.ts --include-tag mlqa
    

    ML functional Basic license tests are located in x-pack/test/functional_basic/apps/ml.

  3. API integration tests with Trial license:

     node scripts/functional_tests_server.js
     node scripts/functional_test_runner.js --config test/api_integration/config.ts --include-tag mlqa
    

    ML API integration Trial license tests are located in x-pack/test/api_integration/apis/ml.

  4. API integration tests with Basic license:

     node scripts/functional_tests_server.js --config test/api_integration_basic/config.ts
     node scripts/functional_test_runner.js --config test/api_integration_basic/config.ts --include-tag mlqa
    

    ML API integration Basic license tests are located in x-pack/test/api_integration_basic/apis/ml.

  5. Accessibility tests:

    We maintain a suite of accessibility tests (you may see them referred to elsewhere as a11y tests). These tests render each of our pages and ensure that the inputs and other elements contain the attributes necessary to ensure all users are able to make use of ML (for example, users relying on screen readers).

     node scripts/functional_tests_server --config test/accessibility/config.ts
     node scripts/functional_test_runner.js --config test/accessibility/config.ts --grep=ml
    

    ML accessibility tests are located in x-pack/test/accessibility/apps.

Shared functions

You can find the ML shared functions in the following files in GitHub:

https://github.com/elastic/kibana/blob/master/x-pack/plugins/ml/public/shared.ts
https://github.com/elastic/kibana/blob/master/x-pack/plugins/ml/server/shared.ts

These functions are shared from the root of the ML plugin, you can import them with an import statement. For example:

import { MlPluginSetup } from '../../../../ml/server';

or

import { ANOMALY_SEVERITY } from '../../ml/common';

Functions are shared from the following directories:

ml/common
ml/public
ml/server