title: ElasticSearch and special characters
body: <p>I can not figure out how to look up words with special characters.</p>
  
  <p>For example, I have two documents:</p>
  
  <p>1) We are looking for C++ and C# developers <br/>
  2) We are looking for C developers</p>
  
  <p>I want only to find a document which contains <code>C++</code>.</p>
  
  <p>Code for creating an index, documents and searching:</p>
  
  <pre><code>from elasticsearch import Elasticsearch
  from elasticsearch.helpers import scan
  
  ELASTIC_SEARCH_NODES = ['http://localhost:9200']
  
  INDEX = 'my_index'
  DOC_TYPE = 'material'
  
  
  def create_index():
      data = {
         "settings": {
            "analysis": {
               "analyzer": {
                  "my_analyzer": {
                     "type": "custom",
                     "filter": [
                        "lowercase"
                     ],
                     "tokenizer": "whitespace",
                  }
               }
            }
         }
      }
  
      print es_client.indices.create(index=INDEX, body=data)
  
  
  def create_doc(body):
  
      if es_client.exists(INDEX, DOC_TYPE, body['docid']):
          es_client.delete(INDEX, DOC_TYPE, body['docid'])
  
      print es_client.create(index=INDEX, doc_type=DOC_TYPE, body=body, id=body['docid'])
  
  
  def find_doc(value):
       results_generator = scan(es_client,
              query={"query": {
  
                      "match_phrase" : {
                          "text" : value
                      }
  
              }},
              index=INDEX
          )
       return results_generator
  
  
  if __name__ == '__main__':
      es_client = Elasticsearch(ELASTIC_SEARCH_NODES, verify_certs=True)
  
      # create_index()
      doc1 = {"docid": 1, 'text': u"We are looking for C developers"}
      doc2 = {"docid": 2, 'text': u"We are looking for C++ and C# developers"}
  
      # create_doc(doc1)
      # create_doc(doc2)
  
      for r in find_doc("C++"):
          print r
  </code></pre>
  
  <p>Search result(if I <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters" rel="nofollow noreferrer">escape</a> <code>+</code> (<code>"C\+\+"</code>), the result will be the same):</p>
  
  <pre><code>{u'_score': 0.0, u'_type': u'material', u'_id': u'2', u'_source': {u'text': u'We are looking for C++ and C# developers', u'docid': 2}, u'_index': u'my_index'}
  {u'_score': 0.0, u'_type': u'material', u'_id': u'1', u'_source': {u'text': u'We are looking for C developers', u'docid': 1}, u'_index': u'my_index'}
  </code></pre>
  
  <p>It seems that such a result is obtained because in the division into tokens symbols like <code>+</code> and <code>#</code> <a href="https://stackoverflow.com/questions/13178550/elasticsearch-return-the-tokens-of-a-field">not indexed</a>, and in fact, it looks for documents in which there is the symbol <code>C</code>:</p>
  
  <pre><code>curl 'http://localhost:9200/my_index/material/_search?pretty=true' -d '{
      "query" : {
          "match_all" : { }
      },
      "script_fields": {
          "terms" : {
              "script": "doc[field].values",
              "params": {
                  "field": "text"
              }
          }
      }
  }'
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>{
    "took" : 3,
    "timed_out" : false,
    "_shards" : {
      "total" : 5,
      "successful" : 5,
      "failed" : 0
    },
    "hits" : {
      "total" : 2,
      "max_score" : 1.0,
      "hits" : [ {
        "_index" : "my_index",
        "_type" : "material",
        "_id" : "2",
        "_score" : 1.0,
        "fields" : {
          "terms" : [ "and", "are", "c", "developers", "for", "looking", "we" ]
        }
      }, {
        "_index" : "my_index",
        "_type" : "material",
        "_id" : "1",
        "_score" : 1.0,
        "fields" : {
          "terms" : [ "are", "c", "developers", "for", "looking", "we" ]
        }
      }]
    }
  }
  </code></pre>
  
  <p>How can this problem be solved? The second question related to the previous: is it possible to search only non-alphanumeric characters such as <code>%</code> or <code>+</code> ?</p>
  
  <p>P.S. I am using Elastic 2.3.2 and elasticsearch=2.3.0.</p>