# Convert KQL string to Query DSL

**URL:** <https://discuss.elastic.co/t/convert-kql-string-to-query-dsl/233966>\
**Category:** Kibana\
**Tags:** kql-kibana-query-language\
**Created:** [May 22, 2020, 9:20pm UTC](https://discuss.elastic.co/t/convert-kql-string-to-query-dsl/233966 "2020-05-22T21:20:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cristian\_Velasquez\_R](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cristian_velasquez_r/32/48107_2.png) [@Cristian\_Velasquez\_R](https://discuss.elastic.co/u/Cristian_Velasquez_R)\
**Post date:** [May 22, 2020, 9:20pm UTC](https://discuss.elastic.co/t/convert-kql-string-to-query-dsl/233966/1 "2020-05-22T21:20:17Z")

</div>

Is there a package I can use to convert a KQL string to the query DSL for elasticsearch?  
[This question](https://discuss.elastic.co/t/javascript-convert-query-string-to-query-dsl/167927) is outdated as that package no longer exists.

---

<div class="post-metadata">

**Author:** ![lukeelmers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukeelmers/32/35230_2.png) [@lukeelmers](https://discuss.elastic.co/u/lukeelmers)\
**Post date:** [May 25, 2020, 5:12pm UTC](https://discuss.elastic.co/t/convert-kql-string-to-query-dsl/233966/2 "2020-05-25T17:12:52Z")

</div>

The `kbn-es-query` package has been relocated to the `data` plugin, but all of the same methods should be available there:

```auto
// old location
import { buildEsQuery } from '@kbn/es-query';
buildEsQuery();

// new location; grouped under an `esQuery` namespace
import { esQuery } from '../../src/plugins/data/public';
esQuery.buildEsQuery();

```

---

<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:** [June 22, 2020, 5:13pm UTC](https://discuss.elastic.co/t/convert-kql-string-to-query-dsl/233966/3 "2020-06-22T17:13:00Z")

</div>

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