# Search if only the all word is repeated more than 1 times in a particular string

**URL:** <https://discuss.elastic.co/t/search-if-only-the-all-word-is-repeated-more-than-1-times-in-a-particular-string/300426>\
**Category:** Elasticsearch\
**Created:** [March 23, 2022, 9:02am UTC](https://discuss.elastic.co/t/search-if-only-the-all-word-is-repeated-more-than-1-times-in-a-particular-string/300426 "2022-03-23T09:02:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![div927](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/div927/32/97523_2.png) [@div927](https://discuss.elastic.co/u/div927)\
**Post date:** [March 23, 2022, 9:02am UTC](https://discuss.elastic.co/t/search-if-only-the-all-word-is-repeated-more-than-1-times-in-a-particular-string/300426/1 "2022-03-23T09:02:11Z")

</div>

I am trying to write a search engine where I want to get the result only, if say -\> chess, player, game words are there I would return result only if all these 3 words present twice or thrice in any of the field ["description","keywords","summary"] in particular index, but its getting me result by single words in single field. Can anyone help me out in this ?  
search\_term = chess player game

```auto
search_result = Elasticsearch::Persistence.client.search \
      index: AlphaES.index_name , 
            type: 'alpha_es',
            body: {
                from: 0,
                size:1000,
                query: {
                bool: {
                    filter: [
                        {
                            "term": {
                            "entity_type": { "value": entity_type }
                            } 
                        },
                        {
                            "term": {
                                "active_flag": { "value": 1 }
                            } 
                        }
                    ],
                    should: [
                    {  
                        "multi_match":{  
                            "query": "#{search_term}",
                            "fields": ["description","keywords","summary"]
                            # "operator": "and"
                            # "boost":5
                        }
                    },
                    {
                        match: {
                            description: {
                                query: "#{search_term}",
                                operator: 'and'
                            # fuzziness: 'AUTO'
                        }
                        }
                    },
                    {
                        match: {
                            keywords: {
                                query: "#{search_term}",
                                operator: 'and'
                            # fuzziness: 'AUTO'
                        }
                        }
                    },
                    {
                        match: {
                            summary: {
                                query: "#{search_term}",
                                operator: 'and'
                            # fuzziness: 'AUTO'
                        }
                        }
                    }
                    ]
                }
                }
            }

```

---

<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:** [April 20, 2022, 9:02am UTC](https://discuss.elastic.co/t/search-if-only-the-all-word-is-repeated-more-than-1-times-in-a-particular-string/300426/2 "2022-04-20T09:02:44Z")

</div>

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