title: Match all exact words in a query
body: <p>I want to create a query using the ElasticSearch Java API which only matches (1) complete words and (2) all of the words from the searchquery. Here is an example for that:</p>
  <p>Text:</p>
  <p><code>hello wonderful world</code></p>
  <p>These should match:</p>
  <pre><code>hello
  hello wonderful
  hello world
  wonderful world
  hello wonderful world
  wonderful
  world
  </code></pre>
  <p>These shouldn't match:</p>
  <ol>
  <li><p><code>hell</code></p>
  </li>
  <li><p><code>hello fniefsgbsugbs</code></p>
  </li>
  </ol>
  <p>I tried the following parameters for a match query but it still matches the two examples above.</p>
  <p>This is the code to generate the query using the ElasticSearch 7.7.1 Java API:</p>
  <pre class="lang-kotlin prettyprint-override"><code>import org.elasticsearch.index.query.QueryBuilders
  ...
  
  QueryBuilders.matchQuery(field, query)
              .autoGenerateSynonymsPhraseQuery(false)
              .fuzziness(0)
              .prefixLength(0)
              .fuzzyTranspositions(false)
              .operator(Operator.AND)
              .minimumShouldMatch(&quot;100%&quot;)
  </code></pre>
  <p>Which will generate this query:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;size&quot;: 100,
    &quot;query&quot;: {
      &quot;bool&quot;: {
        &quot;filter&quot;: [
          {
            &quot;match&quot;: {
              &quot;searchableText&quot;: {
                &quot;query&quot;: &quot;hell&quot;,
                &quot;operator&quot;: &quot;AND&quot;,
                &quot;fuzziness&quot;: &quot;0&quot;,
                &quot;prefix_length&quot;: 0,
                &quot;max_expansions&quot;: 50,
                &quot;minimum_should_match&quot;: &quot;100%&quot;,
                &quot;fuzzy_transpositions&quot;: false,
                &quot;lenient&quot;: false,
                &quot;zero_terms_query&quot;: &quot;NONE&quot;,
                &quot;auto_generate_synonyms_phrase_query&quot;: false,
                &quot;boost&quot;: 1
              }
            }
          }
        ]
      }
    }
  }
  </code></pre>
  <p>Can someone help me to find a good solution for this?</p>
  <p><strong>Edit:</strong> Here are the settings and mappings (I removed everything which isn't relevant for <code>searchableText</code> to make it as minimal as possible):</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;settings&quot;: {
        &quot;analysis&quot;: {
          &quot;normalizer&quot;: {
            &quot;lowercase_normalizer&quot;: {
              &quot;type&quot;: &quot;custom&quot;,
              &quot;filter&quot;: [
                &quot;lowercase&quot;
              ]
            }
          },
          &quot;filter&quot;: {
            &quot;german_stemmer&quot;: {
              &quot;type&quot;: &quot;stemmer&quot;,
              &quot;language&quot;: &quot;light_german&quot;
            },
            &quot;ngram_filter&quot;: {
              &quot;type&quot;: &quot;shingle&quot;,
              &quot;max_shingle_size&quot;: 4,
              &quot;min_shingle_size&quot;: 2,
              &quot;output_unigrams&quot;: false,
              &quot;output_unigrams_if_no_shingles&quot;: false
            }
          },
          &quot;analyzer&quot;: {
            &quot;german&quot;: {
              &quot;tokenizer&quot;: &quot;standard&quot;,
              &quot;filter&quot;: [
                &quot;lowercase&quot;,
                &quot;german_synonyms&quot;,
                &quot;german_stop&quot;,
                &quot;german_keywords&quot;,
                &quot;german_no_stemming&quot;,
                &quot;german_stemmer&quot;
              ]
            },
            &quot;german_ngram&quot;: {
              &quot;tokenizer&quot;: &quot;standard&quot;,
              &quot;filter&quot;: [
                &quot;lowercase&quot;,
                &quot;german_synonyms&quot;,
                &quot;german_keywords&quot;,
                &quot;german_no_stemming&quot;,
                &quot;german_stemmer&quot;,
                &quot;ngram_filter&quot;
              ]
            }
          }
        }
      },
      &quot;mappings&quot;: {
        &quot;properties&quot;: {
          &quot;description&quot;: {
            &quot;type&quot;: &quot;text&quot;,
            &quot;copy_to&quot;: &quot;searchableText&quot;,
            &quot;analyzer&quot;: &quot;german&quot;
          },
          &quot;name&quot;: {
            &quot;type&quot;: &quot;text&quot;,
            &quot;copy_to&quot;: &quot;searchableText&quot;,
            &quot;analyzer&quot;: &quot;german&quot;
          },
          &quot;userTags&quot;: {
            &quot;type&quot;: &quot;keyword&quot;,
            &quot;copy_to&quot;: &quot;searchableText&quot;,
            &quot;normalizer&quot;: &quot;lowercase_normalizer&quot;
          },
          &quot;searchableText&quot;: {
            &quot;type&quot;: &quot;text&quot;,
            &quot;analyzer&quot;: &quot;german&quot;,
            &quot;fields&quot;: {
              &quot;ngram&quot;: {
                &quot;type&quot;: &quot;text&quot;,
                &quot;analyzer&quot;: &quot;german_ngram&quot;
              }
            }
          },
          &quot;searches&quot;: {
            &quot;type&quot;: &quot;keyword&quot;,
            &quot;copy_to&quot;: &quot;searchableText&quot;,
            &quot;normalizer&quot;: &quot;lowercase_normalizer&quot;
          }
        }
      }
    }
  </code></pre>
  <p><strong>Edit 2:</strong> These are the mentioned filters:</p>
  <pre class="lang-json prettyprint-override"><code>&quot;filter&quot;: {
      &quot;german_stop&quot;: {
        &quot;type&quot;: &quot;stop&quot;,
        &quot;stopwords&quot;: &quot;_german_&quot;
      },
      &quot;german_stemmer&quot;: {
        &quot;type&quot;: &quot;stemmer&quot;,
        &quot;language&quot;: &quot;light_german&quot;
      },
      &quot;ngram_filter&quot;: {
        &quot;type&quot;: &quot;shingle&quot;,
        &quot;max_shingle_size&quot;: 4,
        &quot;min_shingle_size&quot;: 2,
        &quot;output_unigrams&quot;: false,
        &quot;output_unigrams_if_no_shingles&quot;: false
      }
  }
  </code></pre>