# java.lang.ClassCastException: org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms cannot be cast to org.elasticsearch.search.aggregations.bucket.terms.StringTerms

**URL:** <https://discuss.elastic.co/t/java-lang-classcastexception-org-elasticsearch-search-aggregations-bucket-terms-parsedstringterms-cannot-be-cast-to-org-elasticsearch-search-aggregations-bucket-terms-stringterms/247615>\
**Category:** Elasticsearch\
**Created:** [September 5, 2020, 6:30am UTC](https://discuss.elastic.co/t/java-lang-classcastexception-org-elasticsearch-search-aggregations-bucket-terms-parsedstringterms-cannot-be-cast-to-org-elasticsearch-search-aggregations-bucket-terms-stringterms/247615 "2020-09-05T06:30:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elastic78](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@elastic78](https://discuss.elastic.co/u/elastic78)\
**Post date:** [September 5, 2020, 6:30am UTC](https://discuss.elastic.co/t/java-lang-classcastexception-org-elasticsearch-search-aggregations-bucket-terms-parsedstringterms-cannot-be-cast-to-org-elasticsearch-search-aggregations-bucket-terms-stringterms/247615/1 "2020-09-05T06:30:26Z")

</div>

I am trying to get aggregations using GROUP By of an attributename and getting the below error.  
StringTerms strAggs = response.getAggregations().get(TermsAggregation.AGGREGATION\_PREFIX + attributeName);  
java.lang.ClassCastException: org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms cannot be cast to org.elasticsearch.search.aggregations.bucket.terms.StringTerms  
CAn anyone help me understand what this is error is. Did not get much info about ParsedString Terms

---

<div class="post-metadata">

**Author:** ![elastic78](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@elastic78](https://discuss.elastic.co/u/elastic78)\
**Post date:** [September 8, 2020, 5:12am UTC](https://discuss.elastic.co/t/java-lang-classcastexception-org-elasticsearch-search-aggregations-bucket-terms-parsedstringterms-cannot-be-cast-to-org-elasticsearch-search-aggregations-bucket-terms-stringterms/247615/2 "2020-09-08T05:12:30Z")

</div>

Can some one please check and share some pointers

---

<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:** [October 6, 2020, 5:12am UTC](https://discuss.elastic.co/t/java-lang-classcastexception-org-elasticsearch-search-aggregations-bucket-terms-parsedstringterms-cannot-be-cast-to-org-elasticsearch-search-aggregations-bucket-terms-stringterms/247615/3 "2020-10-06T05:12:49Z")

</div>

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