title: Elastic Search Aggregations not working with subfield keyword
body: <p>I am new to ES and trying to work with facet creation. But I am stuck at the first step itself. I have an index with a &quot;text&quot; field that has subfield as &quot;keyword&quot; shown below as an example.</p>
  <pre><code>PUT my-index
  {
    &quot;mappings&quot;: {
      &quot;properties&quot;: {
        &quot;flavor&quot;: {
          &quot;type&quot;: &quot;text&quot;,
          &quot;fields&quot;: {
            &quot;text&quot;: {
              &quot;type&quot;: &quot;keyword&quot;
            }
          }
        }
      }
    }
  }
  </code></pre>
  <p>I have 5 documents indexed, and I am trying to create buckets using the query below:</p>
  <pre><code>GET my-index/_search
  {
    &quot;aggs&quot;: {
      &quot;my_buckets&quot;: {
        &quot;terms&quot;: {
          &quot;field&quot;: &quot;flavor.keyword&quot;
        }
      }
    }
  }
  </code></pre>
  <p>I do not get any error but also I do not get any buckets. But I also tried to do it in a reverse way. i.e. make the flavor field to be a keyword and in turn added text as the subfield. This method works and gives me the desired result. The problem here is I cannot change the original mapping which I have. I was expecting to get the results by using flavor.keyword but I hit a dead end now. Can someone please explain this behavior and anyway I can make it working?</p>