Setting the scripting language for inline scripts in TermsAggregation

I am trying to perform a term aggregation using a script to concatenate two fields and I provide a script which is in JavaScript using the JAVA API.

    TermsBuilder termsAggregation = AggregationBuilders.terms("myTerm").script(aggregationScript());

When I execute the query, it fails with the following error:

nested: ElasticsearchIllegalArgumentException[script_lang not supported [groovy]];

Why ElasticSearch is trying to use groovy as a scripting language, and why it is not supported?