-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Search] Server strategy example #71679
[Search] Server strategy example #71679
Conversation
Pinging @elastic/kibana-app-arch (Team:AppArch) |
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.
All this css looks good! ;)
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.
Added a few minor comments below, overall this is looking good. I'm wondering if we may want to show a little more realistic example (rather than a strategy that just returns an extra parameter).
export const PLUGIN_ID = 'searchExamples'; | ||
export const PLUGIN_NAME = 'search_examples'; | ||
|
||
export interface IMyStrategyResponse extends IEsSearchResponse { |
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.
Just some thoughts: I wonder if it will be more common for custom strategies to extend IKibanaSearchResponse
rather than IEsSearchResponse
since they will likely be doing some sort of data manipulation and not sending the raw response back.
/** | ||
* Indicates whether async search is still in flight | ||
*/ | ||
isRunning?: boolean; |
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.
It probably makes sense to either move these directly to IKibanaSearchResponse
, or move id
inside here. Maybe we can have a conversation about what should be in IKibanaSearchResponse
(or if it's necessary).
Renamed is_partial to isPartial Added isPartial and isRunning to OSS response type
Co-authored-by: Lukas Olson <[email protected]>
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.
Added a couple of minor things below... I think this example illustrates that our types need a little work. I have a simple idea I can run by you tomorrow about improving it.
const aggs = [{ type: 'avg', params: { field: selectedField.name } }]; | ||
const aggsDsl = data.search.aggs.createAggConfigs(indexPattern, aggs).toDsl(); |
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.
I think it's good that we're using the agg configs service here, but it doesn't answer the question, "Why would I want to use the data.search.aggs
service instead of just writing the DSL myself?" Maybe just adding a comment would be sufficient.
Co-authored-by: Lukas Olson <[email protected]>
Co-authored-by: Lukas Olson <[email protected]>
Co-authored-by: Lukas Olson <[email protected]>
Co-authored-by: Lukas Olson <[email protected]>
Co-authored-by: Lukas Olson <[email protected]>
@elasticmachine merge upstream |
@elasticmachine merge upstream |
…-strategy-example
…ibana into search/server-strategy-example
@elasticmachine merge upstream |
💚 Build SucceededBuild metricspage load bundle size
History
To update your PR or re-run it, just comment with: |
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.
LGTM
* Server strategy example * Add tsconfig Renamed is_partial to isPartial Added isPartial and isRunning to OSS response type * Docs + remove unused sample code * Fix test naming of arguments * ts * ts fix * Add filters and query input selector * Update examples/search_examples/public/components/app.tsx Co-authored-by: Lukas Olson <[email protected]> * Use new service * exapmle plugin ts * unsubscribe + use timefilter * typo * docs * Add comments and use agg config * Added agg configs Added field selector Added a custom input param * Adding getEsQuery to query service (??) * Add server side example * docs * caps * list plugin in examples page * fix typo * Update examples/search_examples/public/application.tsx Co-authored-by: Lukas Olson <[email protected]> * Update examples/search_examples/public/application.tsx Co-authored-by: Lukas Olson <[email protected]> * Update examples/search_examples/public/components/app.tsx Co-authored-by: Lukas Olson <[email protected]> * Update examples/search_examples/public/components/app.tsx Co-authored-by: Lukas Olson <[email protected]> * Update examples/search_examples/public/components/app.tsx Co-authored-by: Lukas Olson <[email protected]> * eslint Co-authored-by: Lukas Olson <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
…nes/processor-forms-a-d * 'master' of github.com:elastic/kibana: (25 commits) [ML] Removing full lodash library imports (elastic#74742) [Search] Server strategy example (elastic#71679) [Reporting] Fix and test for Listing of Reports (elastic#74453) [maps] fix drawing shapes (elastic#74689) [Resolver] Improve simulator. Add more click-through tests and panel tests. (elastic#74601) Deprecate schema-less specs in Vega (elastic#73805) [Security Solution] Rename Administration > Hosts subtab to Endpoints (elastic#74287) Timelion deprecation doc (elastic#74508) [Functional Tests] Adds a wait time between setting the index pattern and the time field on TSVB (elastic#74736) [Lens] Add styling options for x and y axes on the settings popover (elastic#71829) [Maps] add initial location option that fits to data bounds (elastic#74583) theme function (elastic#73451) [data.ui.query] Write filters to query log from default editor. (elastic#74474) [data.search.SearchSource] Move some SearchSource dependencies to the server. (elastic#74607) [Canvas][tech-debt] Convert renderers (elastic#74134) [security solutions][lists] Adds end to end tests (elastic#74473) pluralized for occurrences vs occurrence (elastic#74564) Update links that pointed to CONTRIBUTING.md (elastic#74757) [Ingest pipelines] Implement tabs in processor flyout (elastic#74469) [Event log] Use Alerts client & Actions client when fetching these types of SOs (elastic#73257) ... # Conflicts: # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/field_components/text_editor.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/manage_processor_form.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/append.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/bytes.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/circle.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/field_name_field.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/convert.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/csv.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date_index_name.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/dissect.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/dot_expander.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/drop.tsx # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts
* master: [Vega] add functional tests for Vega visualization (elastic#74097) [ML] Removing full lodash library imports (elastic#74742) [Search] Server strategy example (elastic#71679) [Reporting] Fix and test for Listing of Reports (elastic#74453) [maps] fix drawing shapes (elastic#74689) [Resolver] Improve simulator. Add more click-through tests and panel tests. (elastic#74601) Deprecate schema-less specs in Vega (elastic#73805) [Security Solution] Rename Administration > Hosts subtab to Endpoints (elastic#74287) Timelion deprecation doc (elastic#74508)
* [Search] Server strategy example (#71679) * Server strategy example * Add tsconfig Renamed is_partial to isPartial Added isPartial and isRunning to OSS response type * Docs + remove unused sample code * Fix test naming of arguments * ts * ts fix * Add filters and query input selector * Update examples/search_examples/public/components/app.tsx Co-authored-by: Lukas Olson <[email protected]> * Use new service * exapmle plugin ts * unsubscribe + use timefilter * typo * docs * Add comments and use agg config * Added agg configs Added field selector Added a custom input param * Adding getEsQuery to query service (??) * Add server side example * docs * caps * list plugin in examples page * fix typo * Update examples/search_examples/public/application.tsx Co-authored-by: Lukas Olson <[email protected]> * Update examples/search_examples/public/application.tsx Co-authored-by: Lukas Olson <[email protected]> * Update examples/search_examples/public/components/app.tsx Co-authored-by: Lukas Olson <[email protected]> * Update examples/search_examples/public/components/app.tsx Co-authored-by: Lukas Olson <[email protected]> * Update examples/search_examples/public/components/app.tsx Co-authored-by: Lukas Olson <[email protected]> * eslint Co-authored-by: Lukas Olson <[email protected]> Co-authored-by: Elastic Machine <[email protected]> * Update kibana.json Co-authored-by: Lukas Olson <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
Did this get reverted? |
Nevermind... My VS Code was not updating properly. |
Summary
This example shows how to use the
data
services, focusing on thedata.search.search
API.It illustrates:
IndexPattern
and aField
.TopNavMenu
.AggConfigs
search
API to execute an Elasticsearch search:es
strategy. Data will be fetched synchronously or asynchronously depending on licensing.myStrategy
that takes a custom request and returns a custom response.To run, start Kibana with
yarn start --run-examples
and find the plugin on the Developer Examples pageThis PR also renames the names
is_partial
andis_running
we get from ES toisPartial
andisRunning
(compatible with naming standards in Kibana.Checklist
Delete any items that are not applicable to this PR.
For maintainers