# How can I query this? (Kibana / Elasticsearch)

**URL:** <https://discuss.elastic.co/t/how-can-i-query-this-kibana-elasticsearch/80649>\
**Category:** Elasticsearch\
**Created:** [March 30, 2017, 9:59am UTC](https://discuss.elastic.co/t/how-can-i-query-this-kibana-elasticsearch/80649 "2017-03-30T09:59:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andre22](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@andre22](https://discuss.elastic.co/u/andre22)\
**Post date:** [March 30, 2017, 9:59am UTC](https://discuss.elastic.co/t/how-can-i-query-this-kibana-elasticsearch/80649/1 "2017-03-30T09:59:21Z")

</div>

Hi,

I'm not sure if this is more a Kibana or Elasticsearch question, sorry if this is in the wrong topic.

Assuming I have two fields:

URL  
UserID

There are two possible URLs (URL1, URL2). And n possible users (User0001, User0002, ...)

How would I query for:

- list of users that have visited both URLs?
- list of users that visited URL1 (but not URL2)
- list of users that did not visit URL1 (somehow the opposite of the previous)

From my understanding the results should go into a data table on Visualize, but maybe I am wrong.  
Thanks for lighting me up! 🙂

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 30, 2017, 10:28am UTC](https://discuss.elastic.co/t/how-can-i-query-this-kibana-elasticsearch/80649/2 "2017-03-30T10:28:32Z")

</div>

You can probably write something like:

> - list of users that have visited both URLs?

```auto
+url:url1 +url:url2

```

> - list of users that visited URL1 (but not URL2)

```auto
+url:url1 -url:url2

```

> - list of users that did not visit URL1 (somehow the opposite of the previous)

```auto
-url:url1

```

---

<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 27, 2017, 10:28am UTC](https://discuss.elastic.co/t/how-can-i-query-this-kibana-elasticsearch/80649/3 "2017-04-27T10:28:38Z")

</div>

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