# Retrieve all unique values that have a common property

**URL:** <https://discuss.elastic.co/t/retrieve-all-unique-values-that-have-a-common-property/76056>\
**Category:** Elasticsearch\
**Created:** [February 22, 2017, 2:32pm UTC](https://discuss.elastic.co/t/retrieve-all-unique-values-that-have-a-common-property/76056 "2017-02-22T14:32:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oranciog](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@oranciog](https://discuss.elastic.co/u/oranciog)\
**Post date:** [February 22, 2017, 2:32pm UTC](https://discuss.elastic.co/t/retrieve-all-unique-values-that-have-a-common-property/76056/1 "2017-02-22T14:32:41Z")

</div>

Hello!

I have an index with the following mapping:

```
{"name":{"type":"keyword"}, "eat":{"type":"keyword"} }

```

For example, in this index there are the following documents:

```
{ "name":"andrew","eat":"banana"}
{ "name":"andrew","eat":"apple"}
{ "name":"john","eat":"banana"}
{ "name":"john","eat":"pear"}
{ "name":"george","eat":"banana"}

```

I need to retrieve _all_ names that have in common a series of properties (for example, _all_ names that have eaten "banana" _AND_ "apple" -\> In the above example, the only response is "andrew").

Is there a possibility to write such a query in Elasticsearch?

Thank you,

---

<div class="post-metadata">

**Author:** ![oranciog](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@oranciog](https://discuss.elastic.co/u/oranciog)\
**Post date:** [February 23, 2017, 1:58pm UTC](https://discuss.elastic.co/t/retrieve-all-unique-values-that-have-a-common-property/76056/2 "2017-02-23T13:58:52Z")

</div>

Bump.

Thank you.

---

<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:** [March 23, 2017, 1:58pm UTC](https://discuss.elastic.co/t/retrieve-all-unique-values-that-have-a-common-property/76056/3 "2017-03-23T13:58:54Z")

</div>

Closed on March 23, 2017, 1:58pm UTC

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