# Query where field1 = field2

**URL:** <https://discuss.elastic.co/t/query-where-field1-field2/17588>\
**Category:** Elasticsearch\
**Created:** [May 19, 2014, 1:15pm UTC](https://discuss.elastic.co/t/query-where-field1-field2/17588 "2014-05-19T13:15:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eunever32](https://avatars.discourse-cdn.com/v4/letter/e/e68b1a/32.png) [@eunever32](https://discuss.elastic.co/u/eunever32)\
**Post date:** [May 19, 2014, 1:15pm UTC](https://discuss.elastic.co/t/query-where-field1-field2/17588/1 "2014-05-19T13:15:06Z")

</div>

Say I have documents with

{  
primary: sport  
secondary: swimming  
}

{  
primary: walking  
secondary: reading  
}

Is there a way in ElasticSearch that I can query  
where primary = secondary ?  
(without specifying any literal value for primary or secondary fields ?)

Thanks,

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/8395c96c-dee2-445a-aa36-0b438c9085a8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8395c96c-dee2-445a-aa36-0b438c9085a8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![eunever32](https://avatars.discourse-cdn.com/v4/letter/e/e68b1a/32.png) [@eunever32](https://discuss.elastic.co/u/eunever32)\
**Post date:** [May 25, 2014, 4:58pm UTC](https://discuss.elastic.co/t/query-where-field1-field2/17588/2 "2014-05-25T16:58:56Z")

</div>

Hey...

No responses.. does that mean it's not possible ?

On Monday, May 19, 2014 2:15:06 PM UTC+1, [eune...@gmail.com](mailto:eune...@gmail.com) wrote:

> Say I have documents with
> 
> {  
> primary: sport  
> secondary: swimming  
> }
> 
> {  
> primary: walking  
> secondary: reading  
> }
> 
> Is there a way in Elasticsearch that I can query  
> where primary = secondary ?  
> (without specifying any literal value for primary or secondary fields ?)
> 
> Thanks,

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f806ab75-c055-450d-b188-effc3c0ff6ea%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f806ab75-c055-450d-b188-effc3c0ff6ea%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:27am UTC](https://discuss.elastic.co/t/query-where-field1-field2/17588/3 "2017-07-06T01:27:07Z")

</div>


