Kibana Query Language (KQL) library to convert KQL to ElasticSearch Query

Hello Experts,

I am trying to create DataQueryInterface (API Layer) which is independent from backend Datasource. Current I am thinking to have ElasticSearch as my datasource but in future if I want to move out of ElasticSearch, that should not break my API layer. For that I was looking at exposing KQL as my DataQueryInterface (API Layer). That way I would have deserialization code from KQL and if I want to move out of ElasticSearch in future, I can use Kibana's deserialization code to populate my POJOs and then form new query to new database.
Could someone please help pointing me to the exact code for this?

Thanks,
Saurabh

Hello Experts,

Could someone help on this please?

Hello Experts,

Could someone please help on this ?

The magical function turning a kql string into Elasticsearch query DSL (note: this isn't a full query, it's just part of it) can be found here: kibana/from_kuery.ts at 77fe1c10870a3fb72eb3643d373c3ba0e7405a1a · elastic/kibana · GitHub

However it's not easy to use outside of Kibana.

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