title: ElasticSearch not returning proper results
body: <p>Currently I'm working with elasticsearch and trying to "search" the documents in the cluster. This is where I am not getting my expected results. I was hoping to get 4 results returned as they all should match the query keyword "te". GET _search</p>
  
  <pre><code>{
  "query": {
     "filtered" : {
          "filter" : {
              "term" : {
                  "source_id" : 1
              }
          },
          "query": {
              "bool" : {
                  "must" : {
                      "term" : { "_all" : "te" }
                  }
              }
          }
      }
  }, 
  "sort": [
    {
       "date": {
          "order": "desc"
       }
    }
  ], 
      "from": 0,
      "size": 5
  }
  </code></pre>
  
  <p>When I run this query I only get 2 results (while I was expecting 4). When I remove the "query: {}" part I get 4 results, with the following "subject" fields:</p>
  
  <pre><code>{
  "subject": ["Testbericht"]
  "subject": ["test"]
  "subject": ["Testbericht"]
  "subject": ["Test to myself"]
  }
  </code></pre>
  
  <p>The filter in the query is to only return results from a specific source (1 source per query).</p>
  
  <p>My mapping:</p>
  
  <pre><code>{
     "messages": {
        "mappings": {
           "message": {
              "_id": {
                 "index": "not_analyzed"
              },
              "properties": {
                 "addresses": {
                    "type": "nested",
                    "properties": {
                       "displayname": {
                          "type": "string"
                       },
                       "email": {
                          "type": "string"
                       },
                       "name": {
                          "type": "string"
                       },
                       "type": {
                          "type": "string"
                       }
                    }
                 },
                 "body": {
                    "type": "string"
                 },
                 "date": {
                    "type": "date",
                    "format": "dateOptionalTime"
                 },
                 "files": {
                    "type": "nested",
                    "properties": {
                       "size": {
                          "type": "long"
                       },
                       "title": {
                          "type": "string"
                       },
                       "type": {
                          "type": "string"
                       }
                    }
                 },
                 "folders": {
                    "type": "nested",
                    "properties": {
                       "id": {
                          "type": "integer"
                       }
                    }
                 },
                 "size": {
                    "type": "long"
                 },
                 "source_id": {
                    "type": "integer"
                 },
                 "subject": {
                    "type": "string"
                 }
              }
           }
        }
     }
  }
  </code></pre>
  
  <p>The results which I get when I try to search on _all = "te"</p>
  
  <pre><code>{
  "subject": ["test"]
  "subject": ["Testbericht"]
  }
  </code></pre>
  
  <p>Inserting documents:</p>
  
  <pre><code>// PHP client from https://github.com/elasticsearch/elasticsearch-php
  // $this-&gt;search = new Elasticsearch\Client();
  // $id is an unique string
  // $attributes is an array of the attributes
  public function insert($id, array $attributes)
  {
      $params = [
          'index' =&gt; self::INDEX,
          'type' =&gt; self::TYPE,
          'id' =&gt; $id,
          'body' =&gt; [
              'source_id' =&gt; $attributes['source_id'],
              'date' =&gt; $attributes['date']-&gt;format(DateTime::ISO8601),
              'size' =&gt; $attributes['size'],
              'subject' =&gt; $attributes['subject'],
              'body' =&gt; $attributes['body'],
              'addresses' =&gt; $attributes['addresses'],
              'files' =&gt; $attributes['files'],
              'folders' =&gt; $attributes['folders'],
          ],
      ];
  
      try
      {
          $this-&gt;search-&gt;index($params);
  
          return true;
      }
      catch(Exception $e)
      {
          throw new Exception($e-&gt;getMessage());
      }
  
      return false;
  }
  </code></pre>