# Querying shingles

**URL:** <https://discuss.elastic.co/t/querying-shingles/236233>\
**Category:** Elasticsearch\
**Created:** [June 8, 2020, 8:58pm UTC](https://discuss.elastic.co/t/querying-shingles/236233 "2020-06-08T20:58:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chari](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@chari](https://discuss.elastic.co/u/chari)\
**Post date:** [June 8, 2020, 8:58pm UTC](https://discuss.elastic.co/t/querying-shingles/236233/1 "2020-06-08T20:58:59Z")

</div>

I have used the following settings to index content and generate bigrams.

```auto

es.indices.create(
  index= "shingles",
  body= {
    "settings": {
      "analysis": {
        "analyzer": {
          "shingle_analyzer": {
            "tokenizer": "standard",
              "filter": [
                "lowercase",
                "stop",
                "shingle_filter",
                "trim",
                "kill_filler"]
          }
      },
      "filter": {
        "shingle_filter":{
          "type" : "shingle",
          "max_shingle_size" : 2,
          "min_shingle_size" : 2,
          "output_unigrams" : "false",
          "output_unigrams_if_no_shingles" : "true",
          "enable_position_increments":"false"
        },
        "kill_filler": {
          "type": "pattern_replace",
          "pattern": ".*_.*",
          "replace": "" 
        }
      }
    }
  },
  "mappings": {
        "properties": {
          "my_join_field": { 
            "type": "join",
            "relations": {
              "document": "page" 
            }
          }   
        }
  }    
})

```

When I run analyze API on a string "Word1 Word2 StopWord1 StopWord2 Word3 Word4", I correctly get 4 shingles  
i) Word1 Word2  
ii) ""  
iii) ""  
iv) Word3 Word4

What query can I use to retrieve content matching i) and/or iv) ?

I have not been able to get match\_phrase or bool must match to work ?

---

<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 6, 2020, 8:59pm UTC](https://discuss.elastic.co/t/querying-shingles/236233/2 "2020-07-06T20:59:03Z")

</div>

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