title: Elasticsearch: nested object under path [messages] is not of nested type
body: <p>I am having a lot of issues with the nested type mapping in Elasticsearch, I have ran this to create my index:</p>
  
  <pre><code>curl -XPOST 'http://localhost:9200/thread_and_messages' -d 
  '{"mappings" : {
      "message": {
          "properties": {
              "messages": {
                  "type": "nested", 
                  "include_in_parent": true, 
                  "properties": {
                      "message_id": {"type": "string"}, 
                      "message_text": {"type": "string"}, 
                      "message_nick": {"type": "string"}
                  }
              }
          }
      }
  }}'
  </code></pre>
  
  <p>Then this is how I've indexed a document:</p>
  
  <pre><code>curl -XPUT 'http://localhost:9200/thread_and_messages/thread/1' -d 
  '{
      "thread_id":"2", 
      "thread_name":"Windows", 
      "created":"Wed Mar 25 2015", 
      "first_nick":"Admin", 
      "messages":[
          {"message_id":"5", "message_text":" Pc with a mouse", "message_nick":"Admin"},
          {"message_id":"6", "message_text":"Keyboard", "message_nick":"Admin"},
          {"message_id":"7", "message_text":"iPhone", "message_nick":"Admin"},
          {"message_id":"8", "message_text":"Gym", "message_nick":"Admin"}]"
  }'
  </code></pre>
  
  <p>This is my query:</p>
  
  <pre><code>curl -XGET 'http://localhost:9200/thread_and_messages/thread/_search' -d 
  '{"query": {
      "bool": {
          "must": [
              {"match": {"thread_name": "windows"}}, 
              {"nested": {
                  "path": "messages", "query": {
                  "bool": {
                      "must": [{
                          "match": {"messages.message_text": "gym"}
                      }]
                  }
                  }
              }}
          ]}
      }
  }'
  </code></pre>
  
  <p>I am receiving this error, even though I have clearly mapped messages as a nested type:</p>
  
  <pre><code>QueryParsingException[[thread_and_messages] [nested] nested object under path [messages] is not of nested type
  </code></pre>