# Content Search with " " ( Double Quotes) not displaying exact results in ES 5.2.2

**URL:** <https://discuss.elastic.co/t/content-search-with-double-quotes-not-displaying-exact-results-in-es-5-2-2/98068>\
**Category:** Elasticsearch\
**Created:** [August 23, 2017, 12:07pm UTC](https://discuss.elastic.co/t/content-search-with-double-quotes-not-displaying-exact-results-in-es-5-2-2/98068 "2017-08-23T12:07:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhisekdg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhisekdg/32/20997_2.png) [@abhisekdg](https://discuss.elastic.co/u/abhisekdg)\
**Post date:** [August 23, 2017, 12:07pm UTC](https://discuss.elastic.co/t/content-search-with-double-quotes-not-displaying-exact-results-in-es-5-2-2/98068/1 "2017-08-23T12:07:57Z")

</div>

When words are searched with "" (Double quotes), it's actually happening partial search. My expection is string wrapped with double quotes should match exact words and highlight with the word searched.

Content - ( For reference only)  
**Routing** is the process of selecting a path for traffic in a network. The **routing** process usually directs forwarding on the basis of **routing-tables**. Structured addresses allow a single **routing** table entry to represent the **route** to a group of devices. Using this map, each **router** independently determines the least-cost path ...

_Text Search_ - **"route"**

_Current Results_ - It's matching **"router"** , **"routing"** , **"routes"** , **"routing-table"** , **"ES(config-router)"** along with **"route"**

_Expected Output match should be_ - **"route"** text should only be matched and it should not match other words.

Used "Ingest Attachment Processor Plugin" for extracting html files and indexed into elastic search.  
[https://www.elastic.co/guide/en/elasticsearch/plugins/5.2/ingest-attachment.html](https://www.elastic.co/guide/en/elasticsearch/plugins/5.2/ingest-attachment.html)

```auto
PUT my_index/_mapping/storage
{
  "properties": {
    "content": {
      "include_in_all": true,
      "analyzer": "match_phrase",
      "term_vector": "with_positions_offsets",
      "type": "text",
      "fields": {
        "ngrammed": {
          "term_vector": "with_positions_offsets",
          "type": "text"
        }
      }
    }
  },
  "meta": {
    "properties": {
      "pageNumber": {
        "type": "long"
      },
      "src": {
        "norms": {
          "enabled": false
        },
        "analyzer": "lowercase_keyword",
        "type": "text"
      }
    }
  }
}

```

Search Query -

```auto
{
  "_source": [
    "meta.pageNumber"
  ],
  "query": {
    "bool": {
      "must": [
        {
          "constant_score": {
            "query": {
              "query_string": {
                "query": "\"route\""
              }
            },
            "boost": 5
          }
        },
        {
          "query_string": {
            "default_field": "content.ngrammed",
            "query": "\"route\""
          }
        }
      ],
      "filter": {
        "term": {
          "meta.src": "456"
        }
      }
    }
  },
  "highlight": {
    "require_field_match": true,
    "fields": {
      "content.ngrammed": {}
    },
    "fragment_size": 100,
    "number_of_fragments": 3
  },
  "sort": {
    "meta.pageNumber": {
      "order": "asc"
    }
  },
  "from": 0,
  "size": "15"
}

```

Any help or guide from Elastic Team will be really helpful to solve it.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [August 24, 2017, 8:36am UTC](https://discuss.elastic.co/t/content-search-with-double-quotes-not-displaying-exact-results-in-es-5-2-2/98068/2 "2017-08-24T08:36:13Z")

</div>

Please share the definition of your analyzer.

---

<div class="post-metadata">

**Author:** ![abhisekdg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhisekdg/32/20997_2.png) [@abhisekdg](https://discuss.elastic.co/u/abhisekdg)\
**Post date:** [August 24, 2017, 9:44pm UTC](https://discuss.elastic.co/t/content-search-with-double-quotes-not-displaying-exact-results-in-es-5-2-2/98068/3 "2017-08-24T21:44:39Z")

</div>

```auto
PUT _template/my_index_1
{
  "template": "my_index*",
  "settings": {
    "index": {
      "analysis": {
        "char_filter": {
          "whitespace_mapping": {
            "mappings": [
              "\\u00A0=>\\u0020"
            ],
            "type": "mapping"
          }
        },
        "analyzer": {
          "lowercase_keyword": {
            "type": "custom",
            "filter": [
              "lowercase"
            ],
            "tokenizer": "keyword"
          },
          "match_phrase": {
            "type": "custom",
            "char_filter": [
              "whitespace_mapping"
            ],
            "filter": [
              "lowercase"
            ],
            "tokenizer": "whitespace"
          },
          "match_phrase_search": {
            "type": "custom",
            "char_filter": [
              "whitespace_mapping"
            ],
            "filter": [
              "lowercase",
              "stop"
            ],
            "tokenizer": "whitespace"
          }
        }
      }
    }
  }
}

```

Index Settings -

```auto
PUT my_index
{
  "settings": {
    "index": {
      "analysis": {
        "filter": {
          "my_ngram": {
            "type": "nGram",
            "min_gram": 1,
            "max_gram": 50
          }
        },
        "analyzer": {
          "default": {
            "type": "custom",
            "char_filter": [
              "whitespace_mapping"
            ],
            "filter": [
              "lowercase",
              "asciifolding",
              "stop",
              "my_ngram",
              "kstem"
            ],
            "tokenizer": "whitespace"
          },
          "default_search": {
            "type": "custom",
            "char_filter": [
              "whitespace_mapping"
            ],
            "filter": [
              "lowercase",
              "asciifolding",
              "kstem"
            ],
            "tokenizer": "whitespace"
          }
        }
      }
    }
  }
}

```

---

<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 21, 2017, 9:44pm UTC](https://discuss.elastic.co/t/content-search-with-double-quotes-not-displaying-exact-results-in-es-5-2-2/98068/4 "2017-09-21T21:44:54Z")

</div>

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