title: Elasticsearch "max_ngram_diff" working for "edge_ngram" but not for "ngram_tokenizer"
body: <p>I've got an Elasticsearch index where I've set <code>"max_ngram_diff": 50</code>, but somehow it seems only to be working for the <code>edge_ngram</code> tokenizer but not for the <code>ngram</code> tokenizer.</p>
  
  <p>I've made this two requests against the same URL <code>http://localhost:9201/index-name/_analyze</code>:</p>
  
  <p><strong>Request 1</strong></p>
  
  <pre><code>{
      "tokenizer":
      {
          "type": "edge_ngram",
          "min_gram": 3,
          "max_gram": 20,
          "token_chars": [
              "letter",
              "digit"
          ]
      },
      "text": "1234567890;abcdefghijklmn;"
  }
  </code></pre>
  
  <p><strong>Request 2</strong></p>
  
  <pre><code>{
      "tokenizer": {
          "type": "ngram",
          "min_gram": 3,
          "max_gram": 20,
          "token_chars": [
              "letter",
              "digit"
          ]
      },
      "text": "1234567890;abcdefghijklmn;"
  }
  </code></pre>
  
  <p>The first request returns the expected result:</p>
  
  <pre><code>{
      "tokens": [
          {
              "token": "123",
              "start_offset": 0,
              "end_offset": 3,
              "type": "word",
              "position": 0
          },
          {
              "token": "1234",
              "start_offset": 0,
              "end_offset": 4,
              "type": "word",
              "position": 1
          },
          {
              "token": "12345",
              "start_offset": 0,
              "end_offset": 5,
              "type": "word",
              "position": 2
          },
          {
              "token": "123456",
              "start_offset": 0,
              "end_offset": 6,
              "type": "word",
              "position": 3
          }, 
          // more tokens
      ]
  }
  </code></pre>
  
  <p>But the second request only returns this:</p>
  
  <pre><code>{
      "error": {
          "root_cause": [
              {
                  "type": "remote_transport_exception",
                  "reason": "[ffe18f1a89e6][172.18.0.3:9300][indices:admin/analyze[s]]"
              }
          ],
          "type": "illegal_argument_exception",
          "reason": "The difference between max_gram and min_gram in NGram Tokenizer must be less than or equal to: [1] but was [17]. This limit can be set by changing the [index.max_ngram_diff] index level setting."
      },
      "status": 400
  }
  </code></pre>
  
  <p>What happened, that the first request with the <code>edge_ngram</code> tokenizer can have a bigger difference between <code>max_gram</code> and <code>min_gram</code> than <code>1</code>, but the second request with the <code>ngram</code> tokenizer can't?</p>
  
  <p>This is my mapping: </p>
  
  <pre><code>{
      "settings": {
          "index": {
              "max_ngram_diff": 50,
              // further settings
           }
       }
  }
  </code></pre>
  
  <p>The used elastisearch version is <code>7.2.0</code></p>
  
  <p>Thanks for your help!</p>