# Using Terms aggregation on custom type

**URL:** <https://discuss.elastic.co/t/using-terms-aggregation-on-custom-type/17618>\
**Category:** Elasticsearch\
**Created:** [May 20, 2014, 10:33am UTC](https://discuss.elastic.co/t/using-terms-aggregation-on-custom-type/17618 "2014-05-20T10:33:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Geert\_Vos](https://avatars.discourse-cdn.com/v4/letter/g/5e9695/32.png) [@Geert\_Vos](https://discuss.elastic.co/u/Geert_Vos)\
**Post date:** [May 20, 2014, 10:33am UTC](https://discuss.elastic.co/t/using-terms-aggregation-on-custom-type/17618/1 "2014-05-20T10:33:23Z")

</div>

Hi,

We are working on search engine that is optimized for searching in time.  
The bases is an elasticsearch cluster with a plugin that registers our own  
type. The type we created is registered using our own type name:  
"timedterms".

Now we try to use the built in aggregations on our own type, and  
ElasticSearch throws an exception because it cannot find any field data  
builder:

Caused by: org.elasticsearch.ElasticsearchIllegalArgumentException: failed  
to find field data builder for field annotations.md::ttxsubtitle, and type  
timedterms  
at org.elasticsearch.index.fielddata.IndexFieldDataService.getForField(  
IndexFieldDataService.java:221)  
at org.elasticsearch.search.aggregations.bucket.terms.TermsParser.parse(  
TermsParser.java:229)  
at org.elasticsearch.search.aggregations.AggregatorParsers.  
parseAggregators(AggregatorParsers.java:114)  
at org.elasticsearch.search.aggregations.AggregatorParsers.  
parseAggregators(AggregatorParsers.java:77)  
at org.elasticsearch.search.aggregations.AggregationParseElement.parse(  
AggregationParseElement.java:60)  
at org.elasticsearch.search.SearchService.parseSource(SearchService.java  
:622)

It seems that the index field data service needs to have our type  
registered. But, it looks like all types are hardcoded in the service and  
there is no extension point. The IndexFieldDataService checks the following  
maps, which are all immutable: "buildersByType", "docValuesBuildersByType",  
"buildersByTypeAndFormat".

How can we reuse the terms aggregation for our own type? Or do we need to  
write our own aggregation?

With kinds regards,  
Geert Vos

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/703d8eed-7129-488e-94fa-df8f1e75b3d5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/703d8eed-7129-488e-94fa-df8f1e75b3d5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:28am UTC](https://discuss.elastic.co/t/using-terms-aggregation-on-custom-type/17618/2 "2017-07-06T01:28:13Z")

</div>


