# Complex queries

**URL:** <https://discuss.elastic.co/t/complex-queries/56562>\
**Category:** Kibana\
**Created:** [July 27, 2016, 9:13pm UTC](https://discuss.elastic.co/t/complex-queries/56562 "2016-07-27T21:13:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_AdWorks](https://avatars.discourse-cdn.com/v4/letter/d/bbce88/32.png) [@Dan\_AdWorks](https://discuss.elastic.co/u/Dan_AdWorks)\
**Post date:** [July 27, 2016, 9:13pm UTC](https://discuss.elastic.co/t/complex-queries/56562/1 "2016-07-27T21:13:53Z")

</div>

is there a way to write a query that will check if the value of a field is within an array

my problem is the following, I have a field that represents domains, I would like to filter all the data the came in from a list of domains but it is about 40-50 domains I tried building a long OR statement but it breaks and doesn't work any recommendations?

another question, is there a way to create a metric that basically is the result of other 2 metrics with a formula Metric A / Metric B

For example I want to be able to show conversion rates, so I want to aggregate all pages views and then aggregate all clicks and divide accordingly on a per page basis - is this possible?

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [July 27, 2016, 10:33pm UTC](https://discuss.elastic.co/t/complex-queries/56562/2 "2016-07-27T22:33:49Z")

</div>

> [@Dan\_AdWorks](#):
>
> I would like to filter all the data the came in from a list of domains but it is about 40-50 domains I tried building a long OR statement but it breaks and doesn't work any recommendations?

A query filter with a number of OR statements is the only way I can think to do that. Does it work with a smaller list of domains? Can you perhaps share the query you tried? And also, how does it break?

> [@Dan\_AdWorks](#):
>
> another question, is there a way to create a metric that basically is the result of other 2 metrics with a formula Metric A / Metric B
> 
> For example I want to be able to show conversion rates, so I want to aggregate all pages views and then aggregate all clicks and divide accordingly on a per page basis - is this possible?

That should be possible in Elasticsearch using [Pipeline Aggregations](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline.html), but unfortunately Kibana doesn't support pipelines yet.

---

<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, 1:43pm UTC](https://discuss.elastic.co/t/complex-queries/56562/3 "2017-07-06T13:43:26Z")

</div>

Closed on July 6, 2017, 1:43pm UTC


