Specifying match_phrases to search for dynamically

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

    "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 ?

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

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