title: Search email addresses in ElasticSearch by regexp
body: <p>How can I search in Elastic by regexp to find email addresses?</p>
  
  <p>I try like that:</p>
  
  <pre><code>{
    "query": {
      "regexp": {
        "data": {
          "value": "[\\w\\'\\.\\_\\+\\-]+@[\\w]+[\\w\\-\\.]*\\.[\\w]+",
          "flags": "ALL"
        }
      }
    }
  }
  </code></pre>
  
  <p>But I get nothing.</p>
  
  <p>There <a href="https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-regexp-query.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-regexp-query.html</a> written that simbol @ means any symbol and therefore it should to be escaped.</p>
  
  <p>Therefore I try like that:</p>
  
  <pre><code>{
        "query": {
          "regexp": {
            "data": {
              "value": "\\@",
              "flags": "ALL"
            }
          }
        }
      }
  </code></pre>
  
  <p>and like that:</p>
  
  <pre><code>{
            "query": {
              "regexp": {
                "data": {
                  "value": "\\@",
                  "flags": "ALL"
                }
              }
            }
          }
  </code></pre>
  
  <p>but I get nothing again.</p>
  
  <p>Any thoughts?</p>
  
  <p><strong>UPDATE</strong>
  I use Elastic Search of 5.2 version on Ubuntu Ubuntu 16.04.2 LTS.</p>
  
  <p>Data samples:</p>
  
  <pre><code>curl -XPOST 'localhost:9200/my_index/index_type/_bulk?pretty' -H 'Content-Type: application/json' -d'
  {"index":{"_id":"1"}}
  {"data":"some text some text some text some text admin@company.comsome text some text some text "}
  {"index":{"_id":"2"}}
  {"data":"some text some text hr@company.comsome text some text "}
  {"index":{"_id":"3"}}
  {"data":"some text some text webmaster@company.comsome text some text "}
  </code></pre>
  
  <p>and searching query:</p>
  
  <pre><code>curl -XGET 'localhost:9200/my_index/index_type/_search?pretty' -H 'Content-Type: application/json' -d'
  {
     "query": {
         "regexp": {
            "data": {
              "value": "\\@",
              "flags": "ALL"
            }
         }
     }
  }
  '
  </code></pre>