# How to convert kibana query to elastic search json programmatically

**URL:** https://discuss.elastic.co/t/how-to-convert-kibana-query-to-elastic-search-json-programmatically/375346
**Category:** Kibana
**Created:** [March 4, 2025, 7:29am UTC](https://discuss.elastic.co/t/how-to-convert-kibana-query-to-elastic-search-json-programmatically/375346 "2025-03-04T07:29:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![zifan\_yan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zifan_yan/32/141770_2.png) [@zifan\_yan](https://discuss.elastic.co/u/zifan_yan)
#### Post date: [March 4, 2025, 7:29am UTC](https://discuss.elastic.co/t/how-to-convert-kibana-query-to-elastic-search-json-programmatically/375346/1 "2025-03-04T07:29:43Z")

</div>

I have KQL looking like these:

1. f6:v6 or (f1:v1 or f2:v2 or (f3:v3 and f4:v4)) and not f5:v5
2. field1:(value1 or value2) and field2:value3 and not field3:value4

I would like to convert to elastic searching json using programming languages like python.(I know how to convert it manually by looking at the inspect-\>request). However, i could not find any resources/libraries doing this. Did I somehow miss the package/Lib?

Thanks in advance
