# Query field in request sent to elasticsearch

**URL:** <https://discuss.elastic.co/t/query-field-in-request-sent-to-elasticsearch/232077>\
**Category:** Kibana\
**Created:** [May 11, 2020, 4:58pm UTC](https://discuss.elastic.co/t/query-field-in-request-sent-to-elasticsearch/232077 "2020-05-11T16:58:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ranitg](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@ranitg](https://discuss.elastic.co/u/ranitg)\
**Post date:** [May 11, 2020, 4:58pm UTC](https://discuss.elastic.co/t/query-field-in-request-sent-to-elasticsearch/232077/1 "2020-05-11T16:58:53Z")

</div>

Hi,  
I'm developing a Kibana plugin. How can I get in my code the payload from a request that is sent to elastic search (it is shown in the Inspect =\> Request UI). I need the query field.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/5/b55cd969fa65c81ddcab19117be2103f4f97984c.png)

---

<div class="post-metadata">

**Author:** ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)\
**Post date:** [May 11, 2020, 6:09pm UTC](https://discuss.elastic.co/t/query-field-in-request-sent-to-elasticsearch/232077/2 "2020-05-11T18:09:25Z")

</div>

Hi,

You will have to connect to ES using http and APIs -  
[https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html)

Hope this helps  
Thanks,  
Bhavya

---

<div class="post-metadata">

**Author:** ![ranitg](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@ranitg](https://discuss.elastic.co/u/ranitg)\
**Post date:** [May 11, 2020, 7:21pm UTC](https://discuss.elastic.co/t/query-field-in-request-sent-to-elasticsearch/232077/3 "2020-05-11T19:21:39Z")

</div>

Hi. I do not want to send a query to es. I want to get by code what kibana sends to es (for example, when adding a filter to the discover page). It is shown in the inspect panel but how do i get it through the code to use in my plugin. I am coding in the hack file.

I am trying to import editor\_registry.ts in my hack file:  
import { instance as registry } from 'core\_plugins/console/np\_ready/application/contexts/editor\_context/editor\_registry';

This does not work. How should I import it? I am using Kibana 7.6.1.  
I'm trying to do the following code:  
const editor = registry.getInputEditor();  
const requests = await editor.getRequestsInRange();

---

<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 8, 2020, 7:21pm UTC](https://discuss.elastic.co/t/query-field-in-request-sent-to-elasticsearch/232077/4 "2020-06-08T19:21:39Z")

</div>

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