# How to achieve contains like combinations into Custom Shingle Analyzer and SimpleQueryString?

**URL:** <https://discuss.elastic.co/t/how-to-achieve-contains-like-combinations-into-custom-shingle-analyzer-and-simplequerystring/235756>\
**Category:** Elastic Search\
**Created:** [June 4, 2020, 12:44pm UTC](https://discuss.elastic.co/t/how-to-achieve-contains-like-combinations-into-custom-shingle-analyzer-and-simplequerystring/235756 "2020-06-04T12:44:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![buka\_bidzina](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/buka_bidzina/32/50141_2.png) [@buka\_bidzina](https://discuss.elastic.co/u/buka_bidzina)\
**Post date:** [June 4, 2020, 12:44pm UTC](https://discuss.elastic.co/t/how-to-achieve-contains-like-combinations-into-custom-shingle-analyzer-and-simplequerystring/235756/1 "2020-06-04T12:44:45Z")

</div>

Hello everyone,  
I want to add some contains like functionality on my SimpleQueryString query. Currently, I am using Custom Shingle Analyzer and if I have tokens like [“elastic”, “search”, “kibana”], it can search its combinations, but combinations I want to achieve are something like this…  
**elasti + searc** or  
**search + ela** or  
**elast + sear + kib**

My index settings:

> ```
> PUT index
> {
> "settings" : {
> "number_of_shards" : "1",
> "analysis" : {
> "filter" : {
> "custom_shingle" : {
> "max_shingle_size" : "2",
> "min_shingle_size" : "2",
> "output_unigrams" : true,
> "type" : "shingle"
> },
> "my_char_filter" : {
> "pattern" : " ",
> "type" : "pattern_replace",
> "replacement" : ""
> }
> },
> "analyzer" : {
> "bigram_combiner" : {
> "filter" : [
> "lowercase",
> "custom_shingle",
> "my_char_filter"
> ],
> "tokenizer" : "standard"
> }
> }
> },
> "number_of_replicas" : "1"
> }
> }
> 
> ```

```
Index mappings:
    PUT index/_mapping
    {
    "properties" : {
          "analyzedName" : {
            "type" : "nested",
            "properties" : {
              "text" : {
                "type" : "text",
                "analyzer" : "bigram_combiner"
              }
            }
          }
    }

Query
    {
      "_source": "analyzedName.text", 
      "from": 0,
      "query": {
        "bool": {
          "must": [
            {
              "nested": {
                "path": "analyzedName",
                "query": {
                  "simple_query_string": {
                    "default_operator": "and",
                    "fields": [
                      "analyzedName.text"
                    ],
                    "query": ""
                  }
                }
              }
            }
          ]
        }
      },
      "size": 10
    }

```

---

<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:** [November 4, 2022, 8:01am UTC](https://discuss.elastic.co/t/how-to-achieve-contains-like-combinations-into-custom-shingle-analyzer-and-simplequerystring/235756/2 "2022-11-04T08:01:07Z")

</div>


