title: Why can't I query correctly against a HashMap field in Elasticsearch?
body: <p>I am using Elasticsearch v1.5.2. I have a JSON document that looks like the following.</p>
  
  <pre><code>{
      "id": "RRRZe32",
      "metadata": {
          "published": "2010-07-29T18:11:43.000Z",
          "codeId": "AChdUxnsuRyoCo7roK6gqZSg",
          "codeTitle": "something"
      }
  }
  </code></pre>
  
  <p>My Java POJO object that backs this JSON looks like the following. Note that I am using Spring-Boot v1.3.0.M2 with <code>spring-boot-starter-data-elasticsearch</code> dependency.</p>
  
  <pre><code>@Document(indexName="ws", type="vid")
  public class Video {
   @Id 
   private String id;
  
  
   @Field(type=FieldType.Object, index=FieldIndex.not_analyzed)
   private Map&lt;String, Object&gt; metadata;
  }
  </code></pre>
  
  <p>My mapping is defined as follows.</p>
  
  <pre><code>{
      "ws": {
          "mappings": {
              "vid": {
                  "properties": {
                      "id": {
                          "type": "string"
                      },
                      "metadata": {
                          "properties": {
                              "codeId": {
                                  "type": "string"
                              },
                              "codeTitle": {
                                  "type": "string"
                              }
                          }
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>I can query the document (using <code>Sense</code>) successfully by <code>metadata.codeTitle</code> but not <code>metadata.codeId</code>. My query for <code>metadata.codeTitle</code> looks like the following.</p>
  
  <pre><code>{
      "query": {
          "bool": {
              "must": [
                  {
                      "term": {
                          "metadata.codeTitle": {
                              "value": "something"
                          }
                      }
                  }
              ]
          }
      }
  }
  </code></pre>
  
  <p>My query for <code>metadata.codeId</code> looks like the following.</p>
  
  <pre><code>{
      "query": {
          "bool": {
              "must": [
                  {
                      "term": {
                          "metadata.codeId": {
                              "value": "AChdUxnsuRyoCo7roK6gqZSg"
                          }
                      }
                  }
              ]
          }
      }
  }
  </code></pre>
  
  <p>Any ideas on what I am doing wrong? </p>