# Specifying match\_phrases to search for dynamically

**URL:** <https://discuss.elastic.co/t/specifying-match-phrases-to-search-for-dynamically/238537>\
**Category:** Elasticsearch\
**Created:** [June 24, 2020, 5:20pm UTC](https://discuss.elastic.co/t/specifying-match-phrases-to-search-for-dynamically/238537 "2020-06-24T17:20:44Z")\
**Posts on this page:** 3\
**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 24, 2020, 5:20pm UTC](https://discuss.elastic.co/t/specifying-match-phrases-to-search-for-dynamically/238537/1 "2020-06-24T17:20:44Z")

</div>

I have a list of bigrams that I would like to search for. How can I specify each of them dynamically ?

```auto
    "query" : {
                         "bool" : {
                           "must": [
                             { "match" : { "content": "<query string>"}},
                           ],
                           "should":[
                                  { "match_phrase" : {"content": bigrams[0]}},
                                  { "match_phrase" : {"content": bigrams[1]}}
                           ]
                         }
               },

```

The length of the bigrams list will vary, so is there a way to specify the match\_phrase strings dynamically ?

---

<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:** [July 8, 2020, 8:21pm UTC](https://discuss.elastic.co/t/specifying-match-phrases-to-search-for-dynamically/238537/2 "2020-07-08T20:21:25Z")

</div>

This is a non issue. I used a cleaner way to work with shingles from the suggestions in the Elasticsearch: The definitive guide.

---

<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:** [August 5, 2020, 8:21pm UTC](https://discuss.elastic.co/t/specifying-match-phrases-to-search-for-dynamically/238537/3 "2020-08-05T20:21:26Z")

</div>

Closed on August 5, 2020, 8:21pm UTC

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