title: Shingles in Elasticsearch, why does this example with custom analyzer fail?
body: <p>I rephrased my problem into a full curl recreation script. That way it might be easier to reproduce the problem (search fails with custom analyzer). I am using the latest ES version for this</p>
  
  <h1>Remove old data</h1>
  
  <pre><code>curl -XDELETE "http://localhost:9200/test_shingling"
  </code></pre>
  
  <h1>Create index with settings</h1>
  
  <pre><code>curl -XPOST "http://localhost:9200/test_shingling/" -d '{
    "settings": {
      "index": {
        "number_of_shards": 10,
        "number_of_replicas": 1
      },
      "analysis": {
        "analyzer": {
          "ShingleAnalyzer": {
            "tokenizer": "BreadcrumbPatternAnalyzer",
            "filter": [
              "standard",
              "lowercase",
              "filter_stemmer",
              "filter_shingle"
            ]
          }
        },
        "filter": {
          "filter_shingle": {
            "type": "shingle",
            "max_shingle_size": 2,
            "min_shingle_size": 2,
            "output_unigrams": false
          },
          "filter_stemmer": {
            "type": "porter_stem",
            "language": "English"
          }
        },
        "tokenizer": {
          "BreadcrumbPatternAnalyzer": {
            "type": "pattern",
            "pattern": " |\\$\\$\\$"
          }
        }
      }
    }
  }'
  </code></pre>
  
  <h1>Define mapping</h1>
  
  <pre><code>curl -XPOST "http://localhost:9200/test_shingling/item/_mapping" -d '{
    "item": {
      "properties": {
        "Title": {
          "type": "string",
          "search_analyzer": "ShingleAnalyzer",
          "index_analyzer": "ShingleAnalyzer"
        }
      }
    }
  }'
  </code></pre>
  
  <h1>Create Document</h1>
  
  <pre><code>curl -XPOST "http://localhost:9200/test_shingling/item/" -d '{
    "Title":"Kyocera Solar Panel Test"
  }'
  </code></pre>
  
  <h1>Test Analyzer PASS</h1>
  
  <pre><code>curl 'localhost:9200/test_shingling/_analyze?pretty=1&amp;analyzer=ShingleAnalyzer' -d 'Kyocera Solar Panel Test'
  </code></pre>
  
  <h1>Wait for ES to be synced (aka refresh indices)</h1>
  
  <pre><code>curl -XPOST "http://localhost:9200/test_shingling/_refresh"
  </code></pre>
  
  <h1>Search "Kyocera Solar Panel Test" FAIL</h1>
  
  <pre><code>curl -XPOST "http://localhost:9200/test_shingling/item/_search?pretty=true" -d '{
    "query": {
      "term": {
        "Title": "Kyocera Solar Panel Test"
      }
    }
  }'
  </code></pre>
  
  <h1>Search "Solar Panel" FAIL</h1>
  
  <pre><code>curl -XPOST "http://localhost:9200/test_shingling/item/_search?pretty=true" -d '{
    "query": {
      "term": {
        "Title": "Kyocera Solar Panel Test"
      }
    }
  }'
  </code></pre>
  
  <h1>Search "Kyocera Solar Panel Test" FAIL</h1>
  
  <pre><code>curl -XPOST "http://localhost:9200/test_shingling/item/_search?pretty=true" -d '{
    "query": {
      "query_string": {
        "default_field": "Title",
        "query": "Kyocera Solar Panel Test"
      }
    }
  }'
  </code></pre>
  
  <h1>Search "Solar Panel" FAIL</h1>
  
  <pre><code>curl -XPOST "http://localhost:9200/test_shingling/item/_search?pretty=true" -d '{
    "query": {
      "query_string": {
        "default_field": "Title",
        "query": "solar panel"
      }
    }
  }'
  </code></pre>