# Filtering to documents containing two fields with the same value?

**URL:** <https://discuss.elastic.co/t/filtering-to-documents-containing-two-fields-with-the-same-value/34285>\
**Category:** Elasticsearch\
**Created:** [November 10, 2015, 8:55pm UTC](https://discuss.elastic.co/t/filtering-to-documents-containing-two-fields-with-the-same-value/34285 "2015-11-10T20:55:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_Harrison](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@Josh\_Harrison](https://discuss.elastic.co/u/Josh_Harrison)\
**Post date:** [November 10, 2015, 8:55pm UTC](https://discuss.elastic.co/t/filtering-to-documents-containing-two-fields-with-the-same-value/34285/1 "2015-11-10T20:55:26Z")

</div>

I've got data that has had two different language recognition algorithms run on it. I would like to build a filter such that if langRec1==langRec2, I get the record back. I could exhaustively set up a list of all the language codes, but I wanted to check if there was a more intelligent way of going about this.  
Essentially, I want to be able to filter documents based on two fields containing exactly the same value. I might not know what the values are, but I want to be exhaustive. Is this possible?

---

<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 5, 2017, 11:39pm UTC](https://discuss.elastic.co/t/filtering-to-documents-containing-two-fields-with-the-same-value/34285/2 "2017-07-05T23:39:24Z")

</div>

Closed on July 5, 2017, 11:39pm UTC


