x-pack/solutions/search/plugins/enterprise_search/README.md
This plugin provides Kibana user interfaces for managing the Enterprise Search solution and its products, App Search and Workplace Search.
Add rich, relevant search to your apps and websites. https://www.elastic.co/app-search/
Unify all your team's content into a personalized search experience. https://www.elastic.co/workplace-search/
localhost:3002.config/kibana.dev.yml with enterpriseSearch.host: 'http://localhost:3002'Problems? If you're an Elastic Enterprise Search engineer, please reach out to @elastic/search-kibana for questions or our in-depth Getting Started developer guide.
Don't forget to read Kibana's contributing documentation and developer guides for more general info on the Kibana ecosystem.
Kibana runs both a frontend and a backend/middleware server. For server development guidelines, see SERVER.md.
Enterprise Search uses Kea.js to manage our React/Redux state for us. Kea state is handled in our *Logic files and exposes values and actions for our components to get and set state with.
For extended guidelines, please check KEA.md
For the most part, we stick to the functionality described in Kea's core concepts. However, in some files, we also take advantage of props and events, as well as manually mounting some shared logic files on plugin init outside of React.
To debug Kea state in-browser, Kea recommends Redux Devtools. To facilitate debugging, we use the path key with snake_cased paths. The path key should always end with the logic filename (e.g. ['enterprise_search', 'some_logic']) to make it easy for devs to quickly find/jump to files via IDE tooling.
Documentation: https://www.elastic.co/guide/en/kibana/current/development-tests.html#_unit_testing
Jest tests can be run from the root kibana directory, however, since the tests take so long to run you will likely want to apply the appropriate Jest configuration file to test only your changes. For example:
x-pack/solutions/search/plugins/enterprise_search/common/jest.config.jsx-pack/solutions/search/plugins/enterprise_search/public/jest.config.jsx-pack/solutions/search/plugins/enterprise_search/server/jest.config.jsyarn test:jest --config {YOUR_JEST_CONFIG_FILE}
yarn test:jest --config {YOUR_JEST_CONFIG_FILE} --watch
Unfortunately coverage collection does not work as automatically, and requires using our handy jest.sh script if you want to run tests on a specific file or folder and only get coverage numbers for that file or folder:
# Running the jest.sh script from the `x-pack/solutions/search/plugins/enterprise_search` folder (vs. kibana root)
# will save you time and allow you to Tab to complete folder dir names
sh jest.sh {YOUR_COMPONENT_DIR}
sh jest.sh public/applications/shared/kibana
sh jest.sh server/routes/app_search
# When testing an individual file, remember to pass the path of the test file, not the source file.
sh jest.sh public/applications/shared/flash_messages/flash_messages_logic.test.ts
FTR configs for stateful search solution are listed in .buildkite/ftr_search_stateful_configs.yml, the main set of functional tests for this plugin are in the x-pack/solutions/search/test/functional_search suite of tests.
These can be run from the root of the Kibana folder with the following command:
node scripts/functional_tests --config=x-pack/solutions/search/test/functional_search/config.ts --bail --quiet
Or if you are updating the tests it can be easier to run the server first so you can re-run the tests many times:
node scripts/functional_tests_server --config=x-pack/solutions/search/test/functional_search/config.ts
One this commands is finished starting the server you run the tests by opening another terminal and running:
node scripts/functional_test_runner --config=x-pack/solutions/search/test/functional_search/config.ts
These scripts can be used with any FTR config.