# Kql search bar not applying

**URL:** <https://discuss.elastic.co/t/kql-search-bar-not-applying/342687>\
**Category:** Kibana\
**Tags:** kibana-plugin-development\
**Created:** [September 10, 2023, 10:13pm UTC](https://discuss.elastic.co/t/kql-search-bar-not-applying/342687 "2023-09-10T22:13:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Farah\_Bhr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/farah_bhr/32/82537_2.png) [@Farah\_Bhr](https://discuss.elastic.co/u/Farah_Bhr)\
**Post date:** [September 10, 2023, 10:13pm UTC](https://discuss.elastic.co/t/kql-search-bar-not-applying/342687/1 "2023-09-10T22:13:24Z")

</div>

Hello ,  
I am developing a cutomized kibana plugin and I added the kql search bar on the top , but my problem is that it is not applying the search bar on the visualized hits  
Here is my try

```auto
const doAsyncSearch = async (strategy?: string, sessionId?: string) => {
    if (!indexPattern) return;
query = data.query.getEsQuery(indexPattern, []);
console.log("query in doAsync:", query);
    const req = {
      params: {
        index: indexPattern.title,
        body: {
          query,
        },
      },
    };
console.log("kbnQuery:", kbnQuery);
    // Submit the search request using the `data.search` service.
    setRequest(req.params.body);
    const searchSubscription$ = data.search
      .search(req, {
        strategy,
        sessionId,
      })
      .subscribe({
        next: (res) => {
            console.log("res:", res);
            setHits(res);
            const message = (
              <EuiText>
                Searched
              </EuiText>
            );
            notifications.toasts.addSuccess(
              {
                title: 'Query result',
                text: 'Query result',
              }
            );
            searchSubscription$.unsubscribe();
            if (res.warning) {
              notifications.toasts.addWarning({
                title: 'Warning',
                text: 'warning',
              });
            }
        },
        error: (e) => {
          notifications.toasts.addDanger({
            title: 'Failed to run search',
            text: e.message,
          });
        },
      });
  };

```

I don't know what I am doing wrong  
Please help me  
The resources are very very limited on developing customized plugin or with outdated references  
Thank you in advance

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 8, 2023, 10:13pm UTC](https://discuss.elastic.co/t/kql-search-bar-not-applying/342687/2 "2023-10-08T22:13:55Z")

</div>

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