# Query match in elasticsearch

**URL:** https://discuss.elastic.co/t/query-match-in-elasticsearch/42607
**Category:** Elasticsearch
**Created:** [February 24, 2016, 3:40pm UTC](https://discuss.elastic.co/t/query-match-in-elasticsearch/42607 "2016-02-24T15:40:32Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Hilal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilal/32/7684_2.png) [@Hilal](https://discuss.elastic.co/u/Hilal)
#### Post date: [February 24, 2016, 3:40pm UTC](https://discuss.elastic.co/t/query-match-in-elasticsearch/42607/1 "2016-02-24T15:40:32Z")

</div>

Hi,  
I want to do text query but my query result is not true.

For example:  
Text1: Road will be made in Turkey  
Text2: Mosque will be made  
Text3: They are comming

Query: `http://10.0.2.15:8080/filter.php?text_field=Road will be made`

result :

Road will be made  
Mosque will be made

My wish is to show only the first text(text1).

My codes:

```
PUT /index
{
  "settings": {
    "analysis": {
      "filter": {
          "turkish_lowercase": {
          "type": "lowercase",
          "language": "turkish"
        }
      },
      "analyzer": {
        "turkish": {
          "tokenizer": "standard",
          "filter": [
            "turkish_lowercase"
          ]
        }
      }
    }
  }          
}

 PUT index/type/_mapping
        {
          "properties": {
            "text": {
              "type": "string",
              "index": "analyzed",
              "analyzer": "turkish""
              
            }
          }
        }

```

How can I do? Can I use fuzzy method?  
if so how do I do ?

Thank you

---

<div class="post-metadata">

### Author: ![Vatsal\_Patel](https://avatars.discourse-cdn.com/v4/letter/v/ad7895/32.png) [@Vatsal\_Patel](https://discuss.elastic.co/u/Vatsal_Patel)
#### Post date: [February 24, 2016, 5:17pm UTC](https://discuss.elastic.co/t/query-match-in-elasticsearch/42607/2 "2016-02-24T17:17:00Z")

</div>

You can do this by removing tokenizer from your analyzer.This will gives you exact query string matching.I hope it will work for you.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [February 24, 2016, 6:34pm UTC](https://discuss.elastic.co/t/query-match-in-elasticsearch/42607/3 "2016-02-24T18:34:59Z")

</div>

Which query are you using behind the scene?  
Match? QueryString?

---

<div class="post-metadata">

### Author: ![Hilal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilal/32/7684_2.png) [@Hilal](https://discuss.elastic.co/u/Hilal)
#### Post date: [February 25, 2016, 8:02am UTC](https://discuss.elastic.co/t/query-match-in-elasticsearch/42607/4 "2016-02-25T08:02:43Z")

</div>

Hi,  
I tried removing tokenizer from your analyzer but it is still the same Vatsal\_Patel.

```
PUT /ihaleler
{
  "settings": {
    "analysis": {
      "filter": {
          "turkish_lowercase": {
          "type": "lowercase",
          "language": "turkish"
        }}}}}

```

I am using match query. I've written the wrong title. I am sorry Dadonet.

PHP codes:

```
unset($filter_text_field);
    if(isset($_GET['text_field'])){
        $filter_text_field['match']['text_field']=$_GET['text_field'];
    }

if(is_array($filter_text_field)){
    $searchParams['body']['query']['bool']['must']=$filter_text_field;
}
```

---

<div class="post-metadata">

### Author: ![Hilal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilal/32/7684_2.png) [@Hilal](https://discuss.elastic.co/u/Hilal)
#### Post date: [February 25, 2016, 9:09am UTC](https://discuss.elastic.co/t/query-match-in-elasticsearch/42607/5 "2016-02-25T09:09:25Z")

</div>

I found it. I used `"match_phrase"` instead of `"match"`

`$filter_text_field['match_phrase']['text_field']=$_GET['text_field'];`

Thanks anyway.

Have a good day.

---

<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:13pm UTC](https://discuss.elastic.co/t/query-match-in-elasticsearch/42607/6 "2017-07-05T23:13:45Z")

</div>


