# \[help|query not working \]elastic engineer 1|lesson 3-combining aggregations

**URL:** <https://discuss.elastic.co/t/help-query-not-working-elastic-engineer-1-lesson-3-combining-aggregations/239908>\
**Category:** Elastic Training\
**Created:** [July 5, 2020, 6:57am UTC](https://discuss.elastic.co/t/help-query-not-working-elastic-engineer-1-lesson-3-combining-aggregations/239908 "2020-07-05T06:57:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![manojb1-in.ibm.com](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@manojb1-in.ibm.com](https://discuss.elastic.co/u/manojb1-in.ibm.com)\
**Post date:** [July 5, 2020, 6:57am UTC](https://discuss.elastic.co/t/help-query-not-working-elastic-engineer-1-lesson-3-combining-aggregations/239908/1 "2020-07-05T06:57:17Z")

</div>

I was trying the query mentioned in lesson3 of elastic engineer1.

 ![Selection_363](https://us1.discourse-cdn.com/elastic/original/3X/7/c/7cb692b50676a013e4fa3f39df2ff92462de5ebd.png)

I used the below query

> GET blogs/\_search  
> {  
> "size": 0,  
> "aggs": {  
> "author\_bucket": {  
> "terms": {  
> "field": "author.keyword",  
> "size": 10  
> },  
> "aggs": {  
> "content\_terms": {  
> "terms": {  
> "field": "content",  
> "size": 10  
> }  
> }  
> }  
> }  
> }  
> }

**Then I was getting the below error**

> {  
> "error": {  
> "root\_cause": [  
> {  
> "type": "illegal\_argument\_exception",  
> "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [content] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."  
> }  
> ],  
> "type": "search\_phase\_execution\_exception",  
> "reason": "all shards failed",  
> "phase": "query",  
> "grouped": true,  
> "failed\_shards": [  
> {  
> "shard": 0,  
> "index": "blogs",  
> "node": "eT9gth30Rbu2\_90THEu0SQ",  
> "reason": {  
> "type": "illegal\_argument\_exception",  
> "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [content] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."  
> }  
> }  
> ],  
> "caused\_by": {  
> "type": "illegal\_argument\_exception",  
> "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [content] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.",  
> "caused\_by": {  
> "type": "illegal\_argument\_exception",  
> "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [content] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."  
> }  
> }  
> },  
> "status": 400  
> }

\*\* Could you please help to resolve this issue?\*\*

---

<div class="post-metadata">

**Author:** ![dschneiter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dschneiter/32/46162_2.png) [@dschneiter](https://discuss.elastic.co/u/dschneiter)\
**Post date:** [July 6, 2020, 8:16am UTC](https://discuss.elastic.co/t/help-query-not-working-elastic-engineer-1-lesson-3-combining-aggregations/239908/2 "2020-07-06T08:16:42Z")

</div>

Hello Manoj

you are referring to a code fragment presented in a lesson. This is about teaching concepts. What you are missing for this code fragment is the corresponding mapping.

You probably tried to replicate that code fragment with the same code, but against a different mapping.

Please check the mapping for field `content`. Is it possible that it is a multi-field made up of a field of type `text` and a field of type `keyword`? If so, then request a `terms`-aggregation for values in field `content.keyword` (as opposed to `content`).

**Background info:** for efficient execution aggregations rely on a data structure called `doc`-values, which is a columnar store made up of document ids along with the values stored in that field. This data structure is not available for fields of type `text`, this is why you are seeing this error reported.

Let me know if that answered your question.

---

<div class="post-metadata">

**Author:** ![dschneiter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dschneiter/32/46162_2.png) [@dschneiter](https://discuss.elastic.co/u/dschneiter)\
**Post date:** [July 8, 2020, 9:28am UTC](https://discuss.elastic.co/t/help-query-not-working-elastic-engineer-1-lesson-3-combining-aggregations/239908/3 "2020-07-08T09:28:36Z")

</div>

Hello @manojb1-in.ibm.com

Di the answer make sense for you? Did you manage to run the example code with the suggested changes?

Best, Daniel

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 7, 2020, 9:28am UTC](https://discuss.elastic.co/t/help-query-not-working-elastic-engineer-1-lesson-3-combining-aggregations/239908/4 "2020-08-07T09:28:40Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
