# Shingles not working with odd no. of search words

**URL:** <https://discuss.elastic.co/t/shingles-not-working-with-odd-no-of-search-words/76356>\
**Category:** Elasticsearch\
**Created:** [February 24, 2017, 6:23am UTC](https://discuss.elastic.co/t/shingles-not-working-with-odd-no-of-search-words/76356 "2017-02-24T06:23:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![moyukh\_bera](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@moyukh\_bera](https://discuss.elastic.co/u/moyukh_bera)\
**Post date:** [February 24, 2017, 6:23am UTC](https://discuss.elastic.co/t/shingles-not-working-with-odd-no-of-search-words/76356/1 "2017-02-24T06:23:06Z")

</div>

[Stackoverflow Link](http://stackoverflow.com/questions/42415512/elasticsearch-shingles-not-working-with-odd-no-of-search-words)

Any help will be appreciated

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [February 24, 2017, 9:53am UTC](https://discuss.elastic.co/t/shingles-not-working-with-odd-no-of-search-words/76356/2 "2017-02-24T09:53:50Z")

</div>

which ES version are you using?

I ran the following on ES 5.1.2 and it looks fine to me:

```auto
DELETE search

PUT search
{
  "settings": {
    "index": {
      "analysis": {
        "filter": {
          "my_shingle_filter": {
            "max_shingle_size": "2",
            "min_shingle_size": "2",
            "output_unigrams": "false",
            "type": "shingle"
          },
          "autocomplete_filter": {
            "type": "edge_ngram",
            "min_gram": "1",
            "max_gram": "40"
          }
        },
        "analyzer": {
          "my_shingle_analyzer": {
            "filter": [
              "lowercase",
              "my_shingle_filter"
            ],
            "type": "custom",
            "tokenizer": "whitespace"
          },
          "shingle_with_autocomplete": {
            "filter": [
              "lowercase",
              "my_shingle_filter",
              "autocomplete_filter"
            ],
            "type": "custom",
            "tokenizer": "whitespace"
          }
        }
      }
    }
  },
  "mappings": {
    "address": {
      "properties": {
        "full_address": {
          "type": "text",
          "norms": false,
          "fields": {
            "shingles": {
              "type": "text",
              "norms": false,
              "analyzer": "shingle_with_autocomplete"
            }
          },
          "analyzer": "whitespace"
        }
      }
    }
  }
}

PUT search/address/581c50297fd84ecc35420570
{
  "full_address": "new delhi nagar palika adarsh vidyalay new delhi nagar palika adarsh vidyalay tilak lane tilak marg area new delhi delhi 110001"
}

PUT search/address/581c502a7fd84ecc35422010
{
  "full_address": "kingdom hall of jehovant witness gyan bharti public school saket new delhi new delhi delhi 110017"
}

GET search/address/_search?_source=full_address
{
  "query": {
    "match": {
      "full_address.shingles": {
        "query": "new delhi",
        "analyzer": "my_shingle_analyzer"
      }
    }
  }
}

GET search/address/_search?_source=full_address
{
  "query": {
    "match": {
      "full_address.shingles": {
          "query": "new delhi nag",
          "analyzer": "my_shingle_analyzer"
      }
    }
  }
}

```

---

<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:** [March 24, 2017, 9:54am UTC](https://discuss.elastic.co/t/shingles-not-working-with-odd-no-of-search-words/76356/3 "2017-03-24T09:54:08Z")

</div>

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