# Matching every documents tokens

**URL:** <https://discuss.elastic.co/t/matching-every-documents-tokens/27212>\
**Category:** Elasticsearch\
**Created:** [August 11, 2015, 6:20pm UTC](https://discuss.elastic.co/t/matching-every-documents-tokens/27212 "2015-08-11T18:20:07Z")\
**Posts on this page:** 2\
**Page:** 1

<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, 6:20pm UTC](https://discuss.elastic.co/t/matching-every-documents-tokens/27212/1 "2015-08-11T18:20:07Z")

</div>

Hi,

My documents are tiny documents (list of words and phrases) and I need that my queries match "whole" documents tokens ("whole" = tokens with stopwords) and not parts of documents.

## EXAMPLE

Documents are like

```
doc1: {"text": "ministry"}
doc2: {"text": "justice"}
doc3: {"text": "ministry of justice"}

```

Analyzer is made of :

```
{“tokenizer": "icu_tokenizer", "filter": ["icu_normalizer", "english_stopwords", "english_stemmer]}

```

A basic match query would be :

```
GET /test/en/_search
{
  "query": {
    "match" : {
      "text": {
        "query" : "<QUERY>",
        "operator": "AND"
      }
    }
  }
} 

```

What query should I use to get following behavior:

- hit **doc3** for query "_the justice ministry_" ?  
A match query with **operator:AND** does the job.  
But it would not be okay if I had an extra document like _{"text": "chef of ministry of justice"}_, it would be matched too.
- hit **doc1** for query "_ministries_" (and not **doc3** ) ?  
If I use a basic match query, I would get documents **doc1** and **doc3** , but I only want **doc1**
- hit **doc2** for query "_justices_" (and not **doc3** ) ?  
If I use a basic match query, I would get documents **doc2** and **doc3** , but I only want **doc2**

Is there a way to do it in a single query ?

Thanks a lot for your help,

---

<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/matching-every-documents-tokens/27212/2 "2017-07-05T23:56:24Z")

</div>


