# How can I get the data if 3 conditions are met

**URL:** https://discuss.elastic.co/t/how-can-i-get-the-data-if-3-conditions-are-met/96972
**Category:** Elasticsearch
**Created:** [August 14, 2017, 1:45pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-data-if-3-conditions-are-met/96972 "2017-08-14T13:45:15Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![skodari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skodari/32/19875_2.png) [@skodari](https://discuss.elastic.co/u/skodari)
#### Post date: [August 14, 2017, 1:45pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-data-if-3-conditions-are-met/96972/1 "2017-08-14T13:45:15Z")

</div>

Hi Team  
I am firing below must match query. I need the data if below 3 conditions are met

```
GET /std_index/std_type/_search
{"query":{
    "bool":
      {"must":[
          {"match":{"std_id":"10002"}},
          {"match":{"user_type":"2"}},
          {"match":{"email_adr":"new90suneelmail@some.com"}}
          ]
      }
  }
}

```

But It's fetching data even three match conditions not yet met.  
out put is

```
{
  "took": 16,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 0.5457982,
    "hits": [
      {
        "_index": "std_index",
        "_type": "std_type",
        "_id": "AV3glvaiYewAq_K9goWm",
        "_score": 0.5457982,
        "_source": {
          "user_created_by": "skodari",
          "create_tms": "2017-08-14T07:52:56.174Z",
          "exp_tms": "2017-08-14T09:06:55.007Z",
          "first_name": "NeBayya",
          "last_name": "NeSuneel",
          "email_adr": "new4suneelmail@some.com",
          "sms_adr": "fresh.att.net",
          "std_id": "10002",
          "user_type": "2",
        }
      }
    ]
  }
}

```

may I know why we are getting this record, even the  
`{"match":{"email_adr":"new90suneelmail@some.com"}}`  
condition not yet met ?  
can anyone please help into this ?  
Thanks `Preformatted text`

---

<div class="post-metadata">

### Author: ![arthur](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@arthur](https://discuss.elastic.co/u/arthur)
#### Post date: [August 14, 2017, 1:52pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-data-if-3-conditions-are-met/96972/2 "2017-08-14T13:52:27Z")

</div>

Hi,  
Is the email\_adr field analyzed? Check by running  
GET [http://elasticsearch:9200/std\_index/\_mapping](http://elasticsearch:9200/std_index/_mapping)

Also, try to change the "match" to "filter".

---

<div class="post-metadata">

### Author: ![skodari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skodari/32/19875_2.png) [@skodari](https://discuss.elastic.co/u/skodari)
#### Post date: [August 14, 2017, 2:07pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-data-if-3-conditions-are-met/96972/3 "2017-08-14T14:07:48Z")

</div>

Thanks  
If I am trying with the filter I am getting same out put.

If I try with above link I am getting below value for "email\_adr"  
`"email_adr":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}`

is this okay ? or Am I wrong ?

Thanks

---

<div class="post-metadata">

### Author: ![arthur](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@arthur](https://discuss.elastic.co/u/arthur)
#### Post date: [August 14, 2017, 2:12pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-data-if-3-conditions-are-met/96972/4 "2017-08-14T14:12:11Z")

</div>

Try to run the same with filter, and "email\_adr.keyword" instead of email\_adr.

---

<div class="post-metadata">

### Author: ![skodari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skodari/32/19875_2.png) [@skodari](https://discuss.elastic.co/u/skodari)
#### Post date: [August 14, 2017, 2:14pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-data-if-3-conditions-are-met/96972/5 "2017-08-14T14:14:54Z")

</div>

> [@arthur](#):
>
> email\_adr.keyword

ohh great !!! thanks Arthur

---

<div class="post-metadata">

### Author: ![arthur](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@arthur](https://discuss.elastic.co/u/arthur)
#### Post date: [August 14, 2017, 2:15pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-data-if-3-conditions-are-met/96972/6 "2017-08-14T14:15:46Z")

</div>

You're welcome!

---

<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: [September 11, 2017, 2:16pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-data-if-3-conditions-are-met/96972/7 "2017-09-11T14:16:14Z")

</div>

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