# \[Kibana 4\] How do I feed a complex query result to terms visualization?

**URL:** <https://discuss.elastic.co/t/kibana-4-how-do-i-feed-a-complex-query-result-to-terms-visualization/35265>\
**Category:** Kibana\
**Created:** [November 23, 2015, 4:41am UTC](https://discuss.elastic.co/t/kibana-4-how-do-i-feed-a-complex-query-result-to-terms-visualization/35265 "2015-11-23T04:41:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fandrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fandrei/32/6092_2.png) [@fandrei](https://discuss.elastic.co/u/fandrei)\
**Post date:** [November 23, 2015, 4:41am UTC](https://discuss.elastic.co/t/kibana-4-how-do-i-feed-a-complex-query-result-to-terms-visualization/35265/1 "2015-11-23T04:41:35Z")

</div>

Is it possible to use a complex query as a data source for a terms visualization, rather than just a simple field specification?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 23, 2015, 4:43am UTC](https://discuss.elastic.co/t/kibana-4-how-do-i-feed-a-complex-query-result-to-terms-visualization/35265/2 "2015-11-23T04:43:48Z")

</div>

You can specify extra json to be added to the KB query in the `Advanced` option of a visualisation.  
Is that what you're after?

---

<div class="post-metadata">

**Author:** ![fandrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fandrei/32/6092_2.png) [@fandrei](https://discuss.elastic.co/u/fandrei)\
**Post date:** [November 23, 2015, 4:45am UTC](https://discuss.elastic.co/t/kibana-4-how-do-i-feed-a-complex-query-result-to-terms-visualization/35265/3 "2015-11-23T04:45:35Z")

</div>

Maybe. What kind of JSON should I put there?  
Kibana 4 looks quite alien after the third version ☹

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 23, 2015, 4:58am UTC](https://discuss.elastic.co/t/kibana-4-how-do-i-feed-a-complex-query-result-to-terms-visualization/35265/4 "2015-11-23T04:58:16Z")

</div>

What sort of query do you want to do?

---

<div class="post-metadata">

**Author:** ![fandrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fandrei/32/6092_2.png) [@fandrei](https://discuss.elastic.co/u/fandrei)\
**Post date:** [November 23, 2015, 5:24am UTC](https://discuss.elastic.co/t/kibana-4-how-do-i-feed-a-complex-query-result-to-terms-visualization/35265/5 "2015-11-23T05:24:29Z")

</div>

The ideal solution would be to use a Lucene query as I was doing in Kibana 3; something like:

FieldX:SomeValue1 OR FieldY:SomeValue2

(and then use some FieldZ from the selected records as the input to the terms visualization)

---

<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:** [July 6, 2017, 2:08pm UTC](https://discuss.elastic.co/t/kibana-4-how-do-i-feed-a-complex-query-result-to-terms-visualization/35265/6 "2017-07-06T14:08:29Z")

</div>

Closed on July 6, 2017, 2:08pm UTC


