# Trying to extract Lucene from Kibana

**URL:** <https://discuss.elastic.co/t/trying-to-extract-lucene-from-kibana/290382>\
**Category:** Kibana\
**Created:** [November 28, 2021, 11:10pm UTC](https://discuss.elastic.co/t/trying-to-extract-lucene-from-kibana/290382 "2021-11-28T23:10:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandra\_Schlichting](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandra_schlichting/32/84122_2.png) [@Sandra\_Schlichting](https://discuss.elastic.co/u/Sandra_Schlichting)\
**Post date:** [November 28, 2021, 11:10pm UTC](https://discuss.elastic.co/t/trying-to-extract-lucene-from-kibana/290382/1 "2021-11-28T23:10:29Z")

</div>

Dear all =)

When I write KQL in the search bar, while having Google Chrome debugging open, I see a request to `bsearch` is made with a cryptic response such as

```auto
eJxEjl1rgzAUhv9Lrr2oijdCb8Za2MB0pnGFj ... ==

```

I suppose the translated Lucene is in there? Can anyone explain how I can decode that?

Hugs,  
Sandra =)

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [November 29, 2021, 1:06am UTC](https://discuss.elastic.co/t/trying-to-extract-lucene-from-kibana/290382/2 "2021-11-29T01:06:22Z")

</div>

Hi @Sandra_Schlichting

Which App are you using Discover? If So you can just use the Inspect to see the actual request and response.

Discover -\> Inspect -\> Request

 ![Screen Shot 2021-11-28 at 5.03.42 PM](https://us1.discourse-cdn.com/elastic/original/3X/a/7/a74ab848f6bdc66e01f1413524ba0225cf48770e.jpeg)

That GUID you show above is not an encoded request, I am pretty sure that GUID of the search request so it can the search can run asynchronously.

If you still _really_ want to look at the request, it would be under the request payload not the headers. And that will end up showing you pretty much the same thing as inspect but it is just broken up a bit different.... the request under Discover -\> Inspect is the equivalent DSL query

 ![Screen Shot 2021-11-28 at 5.02.47 PM](https://us1.discourse-cdn.com/elastic/original/3X/4/a/4a00b94e048d9bcf1e2a895ab741d8f677598f0b.jpeg)

---

<div class="post-metadata">

**Author:** ![Sandra\_Schlichting](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandra_schlichting/32/84122_2.png) [@Sandra\_Schlichting](https://discuss.elastic.co/u/Sandra_Schlichting)\
**Post date:** [November 29, 2021, 9:29am UTC](https://discuss.elastic.co/t/trying-to-extract-lucene-from-kibana/290382/3 "2021-11-29T09:29:50Z")

</div>

Dear @stephenb

That is excellent! Thanks! As you probably have guessed I am looking for am automated way to convert KQL to Lucene =)

Ideally I would prefer [this](https://discuss.elastic.co/t/plans-for-kql-support-in-kibana-stack-alert-elasticsearch-query/290381), and second an official API to convert KQL to Lucene, but I haven't been able to find such. Do you know if there is a feature request to implement an API for this?

I have never tried to crawl a React app (Kibana) before, so that should be interesting if nothing else =)

Hugs,  
Sandra =)

---

<div class="post-metadata">

**Author:** ![Sandra\_Schlichting](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandra_schlichting/32/84122_2.png) [@Sandra\_Schlichting](https://discuss.elastic.co/u/Sandra_Schlichting)\
**Post date:** [November 29, 2021, 11:55am UTC](https://discuss.elastic.co/t/trying-to-extract-lucene-from-kibana/290382/4 "2021-11-29T11:55:02Z")

</div>

Hi @stephenb

I just noticed something interesting.

If I disable network in Chrome for the Kibana Discover page, and then enter a KQL string in the search bar, press enter and look that (failed) request, the KQL have already been converted to Lucene. That must mean the conversion is done client side.

My current thought is to write a crawler, would this make it easier?

Or can you give me some info what would make it easier? =)

Hugs,  
Sandra =)

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [November 29, 2021, 3:58pm UTC](https://discuss.elastic.co/t/trying-to-extract-lucene-from-kibana/290382/5 "2021-11-29T15:58:28Z")

</div>

> [@Sandra\_Schlichting](#):
>
> and second an official API to convert KQL to Lucene, but I haven't been able to find such.

No I do not see that in the repo perhaps you should open a Feature Request against Elasticsearch.

With respect to where the actual code in Kibana that does the KQL - DSL conversion ... I do not know.. I asked not sure if / when I will get an answer....

Update Looks like it is here : From Engineering  
"It depends a bit on the actual place whether we compile it in the browser or in the Kibana server, but it's def Kibana side. KQL is nothing ES understands."

> <https://github.com/elastic/kibana/tree/main/packages/kbn-es-query/src/kuery>
>
> //github.com/elastic/kibana/tree/main/packages/kbn-es-query/src/kuery

---

<div class="post-metadata">

**Author:** ![Sandra\_Schlichting](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandra_schlichting/32/84122_2.png) [@Sandra\_Schlichting](https://discuss.elastic.co/u/Sandra_Schlichting)\
**Post date:** [November 29, 2021, 7:42pm UTC](https://discuss.elastic.co/t/trying-to-extract-lucene-from-kibana/290382/6 "2021-11-29T19:42:17Z")

</div>

Ok, so that is very interesting that the same code also is run server side in some cases.

My experience with crawling is that it is often easier to parse in parameters (KQL in this case) to something where the response comes back from the server, and not the client.

Can you ask Engineering, if they can think of a place in Kibana, where the KQL to Lucene conversion is done server side? And therefore perhaps easier to crawl? =)

---

<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:** [December 27, 2021, 7:42pm UTC](https://discuss.elastic.co/t/trying-to-extract-lucene-from-kibana/290382/7 "2021-12-27T19:42:23Z")

</div>

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