title: How to apply search in Elasticsearch in python with and without whitespces
body: <p>I am building a search system using ElasticSearch in python. I loaded a csv and created an index for search.</p>
  
  <pre><code>from elasticsearch import helpers, Elasticsearch
  import csv
  
  es = Elasticsearch()
  
  with open('/Users/anubhav/Office/elasticsearch-5.6.0/all_products.csv') as f:
      reader = csv.DictReader(f)
      helpers.bulk(es, reader, index='product-index', doc_type='product-index')
  
  es.indices.create(
      index='product-index',
      body={
        "settings": {
          "analysis": {
            "analyzer": {
              "my_analyzer": {
                "tokenizer": "my_tokenizer"
              }
            },
            "tokenizer": {
              "my_tokenizer": {
                "type": "edge_ngram",
                "min_gram": 2,
                "max_gram": 10,
                "token_chars": [
                  "letter",
                  "digit",
                  "whitespace"
                ]
              }
            }
          }
        }
      },
      # Will ignore 400 errors, remove to ensure you're prompted
      ignore=400
  )
  
  response = es.search(
  index='product-index',
  body={
      "query": {
          "match": {
              "product": "PD5MP2 price"
          }
      },
      "aggs": {
          "top_10_states": {
              "terms": {
                  "field": "state",
                  "size": 10
              }
          }
      }
  }
  )
  
  print response
  </code></pre>
  
  <p>The csv looks something like:
  <a href="https://i.stack.imgur.com/4Y4Xj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4Y4Xj.png" alt="CSV sample"></a></p>
  
  <p>when I do search using: </p>
  
  <pre><code>res = es.search(index="product-index", doc_type="product-index", body={"query": {"match": {"product": "DD 350"}}})
  </code></pre>
  
  <p>this works fine because the exact product is there in CSV. But when I change the query to </p>
  
  <pre><code>res = es.search(index="product-index", doc_type="product-index", body={"query": {"match": {"product": "DD350"}}})
  </code></pre>
  
  <p>It doesn't works. Can someone please help me with this?</p>