title: Elasticsearch: How to query an array field using OR condition?
body: <p>I have a few ElasticSearch documents, which contain an Array field.<br></p>
  
  <p>I want to be able to search the whole index<br>
  To find the documents which firstly contains the array field,<br> 
  and if they do, find those documents which contain the value to be searched.<br></p>
  
  <p><strong>Following is my data -</strong><br></p>
  
  <pre><code>{
    "took" : 633,
    "timed_out" : false,
    "_shards" : {
      "total" : 1,
      "successful" : 1,
      "skipped" : 0,
      "failed" : 0
    },
    "hits" : {
      "total" : {
        "value" : 4,
        "relation" : "eq"
      },
      "max_score" : 1.0,
      "hits" : [
        {
          "_index" : "demo",
          "_type" : "1",
          "_id" : "1",
          "_score" : 1.0,
          "_source" : {
            "name" : "anon",
            "nick_name" : "an",
            "hobbies" : [
              "reading",
              "writing"
            ]
          }
        },
        {
          "_index" : "demo",
          "_type" : "1",
          "_id" : "2",
          "_score" : 1.0,
          "_source" : {
            "name" : "anon2",
            "nick_name" : "an2",
            "hobbies" : [
              "playing",
              "studying"
            ]
          }
        },
        {
          "_index" : "demo",
          "_type" : "1",
          "_id" : "3",
          "_score" : 1.0,
          "_source" : {
            "name" : "anon3",
            "nick_name" : "an3",
            "hobbies" : [
              "playing",
              "writing"
            ]
          }
        },
        {
          "_index" : "demo",
          "_type" : "1",
          "_id" : "4",
          "_score" : 1.0,
          "_source" : {
            "name" : "anon4",
            "nick_name" : "an4"
          }
        }
      ]
    }
  }
  </code></pre>
  
  <p>I want to get those documents whose hobbies array contains <strong>"playing" or "studying"</strong> value<br>
  ie. documents 2 and 3</p>
  
  <p><strong>Following are my data creation queries -</strong></p>
  
  <pre><code>POST /demo/_doc/1
  {
    "name":"anon",
    "nick_name":"an",
    "hobbies":["reading","writing"]
  }
  
  POST /demo/_doc/2
  {
    "name":"anon2",
    "nick_name":"an2",
    "hobbies":["playing","studying"]
  }
  
  POST /demo/_doc/3
  {
    "name":"anon3",
    "nick_name":"an3",
    "hobbies":["playing","writing"]
  }
  
  POST /demo/_doc/4
  {
    "name":"anon4",
    "nick_name":"an4"
  }
  
  GET demo/_search
  {
    "query": {
      "match_all": {}
    }
  }
  </code></pre>
  
  <p><strong>The following query is able to get me single search, but how can I achieve Or condition?</strong></p>
  
  <pre><code>GET demo/_search
  {
    "query": {
      "match": {
        "hobbies": "playing"
      }
    }
  }
  </code></pre>