# Facing issue while exact match

**URL:** <https://discuss.elastic.co/t/facing-issue-while-exact-match/85373>\
**Category:** Elasticsearch\
**Created:** [May 11, 2017, 10:41am UTC](https://discuss.elastic.co/t/facing-issue-while-exact-match/85373 "2017-05-11T10:41:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gautam\_Vanani](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@Gautam\_Vanani](https://discuss.elastic.co/u/Gautam_Vanani)\
**Post date:** [May 11, 2017, 10:41am UTC](https://discuss.elastic.co/t/facing-issue-while-exact-match/85373/1 "2017-05-11T10:41:01Z")

</div>

Hi I'm trying to do exact match using filter, but it is not returning expacted result,  
in result scrore is 0 but still it is returning documents by matching some words given in match query,

below is query:

> ```
> GET history/saved_search/_search
> {
> "_source": "saved_search_name", 
> "query": {
> "bool": {
> "filter": {
> "bool": {
> "must": [
> {
> "match": {
> "login_name": "superman"
> }
> },
> {
> "match": {
> "saved_search_name": "Low quality clothes"
> }
> }
> ]
> }
> }
> }
> }
> }
> 
> ```

getting this as result

```
"hits": {
    "total": 2,
    "max_score": 0,
    "hits": [
      {
        "_index": "history",
        "_type": "saved_search",
        "_id": "AVv2tSUeWjRMtjG_6lOM",
        "_score": 0,
        "_source": {
          "saved_search_name": "Our preferred clothes"
        }
      },
      {
        "_index": "history",
        "_type": "saved_search",
        "_id": "AVv2rdFJWjRMtjG_6lOK",
        "_score": 0,
        "_source": {
          "saved_search_name": "Quality clothes with."
        }
      }
    ]
  }

```

this is setting of the index

```
{
  "history": {
    "aliases": {},
    "mappings": {
      "saved_search": {
        "properties": {
          "login_name": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "party_id": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "saved_search_name": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          }
        }
      }
    },
    "settings": {
      "index": {
        "creation_date": "1493373943740",
        "number_of_shards": "5",
        "number_of_replicas": "1",
        "uuid": "QDDPk5EuQR-8IgUDv33UeA",
        "version": {
          "created": "5030199"
        },
        "provided_name": "history"
      }
    }
  }
}

```

Can any one help to solve this?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![avr](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@avr](https://discuss.elastic.co/u/avr)\
**Post date:** [May 11, 2017, 10:53am UTC](https://discuss.elastic.co/t/facing-issue-while-exact-match/85373/2 "2017-05-11T10:53:21Z")

</div>

For `exact match` type queries use `term` query instead of `match`. Replace your field names in queries with their respective `.keyword` form e.g replace `saved_search_name` with `saved_search_name.keyword`

---

<div class="post-metadata">

**Author:** ![Gautam\_Vanani](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@Gautam\_Vanani](https://discuss.elastic.co/u/Gautam_Vanani)\
**Post date:** [May 11, 2017, 11:21am UTC](https://discuss.elastic.co/t/facing-issue-while-exact-match/85373/3 "2017-05-11T11:21:56Z")

</div>

@avr Thank you for response.  
It works and if I'm using `.keyword` with `match` than it is also working fine.

> [@avr](#):
>
> Replace your field names in queries with their respective .keyword

Can you please explain how it works?

---

<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:** [June 8, 2017, 11:35am UTC](https://discuss.elastic.co/t/facing-issue-while-exact-match/85373/4 "2017-06-08T11:35:46Z")

</div>

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