# How to find multiple exact values on a particular field in elasticsearch query?

**URL:** <https://discuss.elastic.co/t/how-to-find-multiple-exact-values-on-a-particular-field-in-elasticsearch-query/22524>\
**Category:** Elasticsearch\
**Created:** [March 5, 2015, 2:16am UTC](https://discuss.elastic.co/t/how-to-find-multiple-exact-values-on-a-particular-field-in-elasticsearch-query/22524 "2015-03-05T02:16:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![murali](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@murali](https://discuss.elastic.co/u/murali)\
**Post date:** [March 5, 2015, 2:16am UTC](https://discuss.elastic.co/t/how-to-find-multiple-exact-values-on-a-particular-field-in-elasticsearch-query/22524/1 "2015-03-05T02:16:35Z")

</div>

My Sample Data is shown below:

`{"listings":{"title" : "testing 1", "address" : { "line1" : "3rd cross", "line2" : "6th main", "line3" : "", "landmark" : "", "location" : "k r puram", "pincode" : "", "city" : "Bangalore" },"purpose":"rent","published": true, "inActive": false }, {"listings":{"title" : "testing 2", "address" : { "line1" : "3rd cross", "line2" : "6th main", "line3" : "", "landmark" : "", "location" : "banaswadi", "pincode" : "", "city" : "Bangalore" },"purpose":"sale","published": true, "inActive": false }, {"listings":{"title" : "testing 3", "address" : { "line1" : "3rd cross", "line2" : "6th main", "line3" : "", "landmark" : "", "location" : "tin factory", "pincode" : "", "city" : "Bangalore" },"purpose":"rent","published": true, "inActive": false }`

My index mapping is shown below:

```
curl -X PUT localhost:9200/testing/listings/_mapping -d '{
 "listings" : {
    "properties" : {
        "address" : {
           "properties": {
              "location": { "type" : "string",
                            "index" : "not_analyzed"
               }
            }
        },
        "suggest" : { 
             "type" : "completion", 
             "index_analyzer" : "simple",
             "search_analyzer" : "simple",
             "payloads" : true
        }                              
    }                                  
  }
}'

```

I access the listings object based on purpose property value like rent or  
sale. I am able to access the objects for rent and sale individually. How  
can i access listings object for both rent and sale values. I have used  
below query to fetch both rent & sale listings object.

```
{"query":{
   "filtered": {
     "filter": {
       "terms": {
         "purpose" : ["rent", "sale"]
        }
      }
    },
   "bool":{
     "must":[
       {"match":{"published":true}},
       {"match":{"inActive":false}},
       {"match":{"address.city": "bangalore"}}
      ]
   }
 }
}

```

Please suggest the changes as needed. Thanks in advance.

--  
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/21ed4bf4-5fec-4d09-8c5c-5efca0ae125c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/21ed4bf4-5fec-4d09-8c5c-5efca0ae125c%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, 12:28am UTC](https://discuss.elastic.co/t/how-to-find-multiple-exact-values-on-a-particular-field-in-elasticsearch-query/22524/2 "2017-07-06T00:28:24Z")

</div>

Closed on July 6, 2017, 12:28am UTC


