How to involve KQL search bar in Kibana Plugin

Are there any ways I can have this KQL search bar in my own plugin? By default, the plugin only contains the time filter on the right.

you can use plugins.data.ui.SearchBar, take a look at how discover, dashboard or visualize app do it.

Is SearchBar included in TopNavMenu? I searched SearchBar in Discover and Dashboard apps and couldn't find it. But I found this: https://github.com/elastic/kibana/tree/7.14/src/plugins/discover/public/application/apps/main/components/top_nav, which looked like something related to SearchBar. Could you help me check this?

In your app.tsx file, simply enable the searchbar and the filters:

<navigation.ui.TopNavMenu appName={PLUGIN_ID} showSearchBar={true} showFilterBar={false} ....

1 Like

There is an example app for search here

It shows how to build an app with KQL search which uses data plugin to run searches.
A sample navbar usage is here

to run Kibana with examples plugins: yarn start --run-examples and you will see a Developer examples section in Kibana's navigation

Thanks! I have checked the search_examples you mentioned and successfully integrated the search bar into my plugin.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.