# Query elasticearch from kibana visualization

**URL:** <https://discuss.elastic.co/t/query-elasticearch-from-kibana-visualization/80704>\
**Category:** Kibana\
**Created:** [March 30, 2017, 3:09pm UTC](https://discuss.elastic.co/t/query-elasticearch-from-kibana-visualization/80704 "2017-03-30T15:09:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bouboune](https://avatars.discourse-cdn.com/v4/letter/b/dfb087/32.png) [@bouboune](https://discuss.elastic.co/u/bouboune)\
**Post date:** [March 30, 2017, 3:09pm UTC](https://discuss.elastic.co/t/query-elasticearch-from-kibana-visualization/80704/1 "2017-03-30T15:09:50Z")

</div>

Hello,

1 - Is there a way to query elasticsearch instead of aggregation from a visualization?

2 - Is it possible to get the input of the search bar and query elasticsearch with it ?

3 - How can i perform query with dynamic fields ?

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [March 30, 2017, 10:58pm UTC](https://discuss.elastic.co/t/query-elasticearch-from-kibana-visualization/80704/2 "2017-03-30T22:58:31Z")

</div>

Hi bouboune,

In this gif I query for "warning" and after it completes I collapse the histogram and that shows the Request button. If you click that you can see and copy the request. Then you can go to the Dev Tools \> Console and put `GET _search` and paste that query body and execute it.

 ![](https://us1.discourse-cdn.com/elastic/original/3X/3/1/318ab35f252d73726d82242c274f2f73dcd03ded.gif)

I'm not sure what you mean by `dynamic fields`. Do you mean scripted fields?

Regards,  
Lee

---

<div class="post-metadata">

**Author:** ![bouboune](https://avatars.discourse-cdn.com/v4/letter/b/dfb087/32.png) [@bouboune](https://discuss.elastic.co/u/bouboune)\
**Post date:** [March 31, 2017, 12:47pm UTC](https://discuss.elastic.co/t/query-elasticearch-from-kibana-visualization/80704/3 "2017-03-31T12:47:34Z")

</div>

Hi,

Sorry my questions was unclear, i reformulate my question.  
Can you nest queries, so the output of one query is the input to another query.  
i.e in SQL:

SELECT \* FROM logs WHERE logs.UserId = (SELECT UserId FROM logs WHERE **logs.guid** ='AERGFCVeaTLKNeFge')

The logs.guid in the second SELECT is the "dynamic field", in other word querys with parameters.

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [March 31, 2017, 1:12pm UTC](https://discuss.elastic.co/t/query-elasticearch-from-kibana-visualization/80704/4 "2017-03-31T13:12:39Z")

</div>

OK, now I understand. No, Kibana can't do that. You would have to write an Elasticsearch client application to do that in 2 steps.

If you search for more information, you should search for `subquery`, and not `nested query`. In Elasticsearch terms they consider a `nested query` one where you are searching for `nested objects` in docs, not searching based on the results of another search.

Here's another example of your question; [https://stackoverflow.com/questions/28734436/what-is-the-elasticsearch-equivalent-for-an-sql-subquery](https://stackoverflow.com/questions/28734436/what-is-the-elasticsearch-equivalent-for-an-sql-subquery)

Regards,  
Lee

---

<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:** [April 28, 2017, 1:12pm UTC](https://discuss.elastic.co/t/query-elasticearch-from-kibana-visualization/80704/5 "2017-04-28T13:12:54Z")

</div>

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