title: Elasticsearch 7.2 create index with mapping and custom analyzer php
body: <p>I'm trying to override the elastic search analyzer so exact match emails are returned for an autocomplete I'm working on. I'm currently using the PHP library for elastic search but most of the question is in JSON as it's easier for me to work directly with JSON rather than nested PHP arrays. </p>
  
  <p>I've found some old examples for previous versions I presume but have had no luck creating an index with both mapping and a custom analyzer in version 7.2</p>
  
  <pre><code>  $queryStr= &lt;&lt;&lt;'EOD'
      {
         "index":"my_db",
         "body":{
            "settings":{
  
               "analysis":{
                  "analyzer":{
                     "my_email_analyzer":{
                        "type":"custom",
                        "tokenizer":"uax_url_email",
                        "filter":[
                           "lowercase",
                           "stop"
                        ]
                     }
                  }
               }
  
            },
            "mapping":{
               "properties":{
  
                  "ak_first_name":{
                     "type":"text",
                     "fields":{
                        "keyword":{
                           "type":"keyword",
                           "ignore_above":256
                        }
                     }
                  },
                  "ak_last_name":{
                     "type":"text",
                     "fields":{
                        "keyword":{
                           "type":"keyword",
                           "ignore_above":256
                        }
                     }
                  },
  
  
                  "uID":{
                     "type":"text",
                     "fields":{
                        "keyword":{
                           "type":"keyword",
                           "ignore_above":256
                        }
                     }
                  },
                  "email":{
                     "type":"text",
                     "fields":{
                        "keyword":{
                           "type":"string",
                           "analyzer":"my_email_analyzer"
                        }
                     }
                  }
               }
            }
         }
      }
      EOD;
  
  
      $this-&gt;client-&gt;indices()-&gt;create($queryStr);
  </code></pre>