# Partial List Of Words Match in documents

**URL:** <https://discuss.elastic.co/t/partial-list-of-words-match-in-documents/24042>\
**Category:** Elasticsearch\
**Created:** [June 21, 2015, 4:59am UTC](https://discuss.elastic.co/t/partial-list-of-words-match-in-documents/24042 "2015-06-21T04:59:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![becjit](https://avatars.discourse-cdn.com/v4/letter/b/2bfe46/32.png) [@becjit](https://discuss.elastic.co/u/becjit)\
**Post date:** [June 21, 2015, 4:59am UTC](https://discuss.elastic.co/t/partial-list-of-words-match-in-documents/24042/1 "2015-06-21T04:59:37Z")

</div>

Hi,  
The ask is different from partial matches using n gram.

Suppose I have three documents with a field called file\_content with type String (Default Full Text Search enabled)

First Document  
{ \_id: 1, file\_content: "I love tennis and cricket"}  
Second document:  
{ \_id: 2, file\_content: "tennis and football are very popular"}  
Third document:  
{\_id: 3, file\_content" "football and cricket are originated in england"}

Now if I search with a list of words such as **[tennis,cricket,football]** is it possible to get following result:  
[  
{\_id:1, includes; ["tennis", "cricket"]}  
{\_id:2, includes; ["tennis", "football"]}  
{\_id:1, includes; ["football", "cricket"]}  
]

Thanks in advance,

---

<div class="post-metadata">

**Author:** ![francoisguerin](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@francoisguerin](https://discuss.elastic.co/u/francoisguerin)\
**Post date:** [August 11, 2015, 5:28pm UTC](https://discuss.elastic.co/t/partial-list-of-words-match-in-documents/24042/2 "2015-08-11T17:28:49Z")

</div>

Hi,  
You should take a look at bool queries and minimum\_should\_match.  
Here is what you can do :

```
GET /becjit/examples/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "file_content": {
              "query": "tennis",
              "_name": "tennis"
            }
          }
        },
        {
          "match": {
            "file_content": {
              "query": "football",
              "_name": "football"
            }
          }
        },
        {
          "match": {
            "file_content": {
              "query": "cricket",
              "_name": "cricket"
            }
          }
        }
      ],
      "minimum_should_match":3
    }
  }
} 

```

You get only results that match 2 queries (football, cricket, tennis) or more.  
Each hit got a field "matched\_queries" that gives name of queries (see field "\_name") that matched the document.

> [@becjit](#):
>
> football and cricket are originated in england

---

<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 5, 2017, 11:56pm UTC](https://discuss.elastic.co/t/partial-list-of-words-match-in-documents/24042/3 "2017-07-05T23:56:25Z")

</div>


