Aggregations: key_as_string only shown when format specified in terms agg

The key_as_string field is now not shown in the terms aggregation for long and double fields unless the format parameter is specified

Closes #7125
This commit is contained in:
Colin Goodheart-Smithe 2014-08-05 10:38:59 +01:00
parent 0da5cecc3c
commit 9c89fcf5a2
2 changed files with 2 additions and 2 deletions

View File

@ -180,7 +180,7 @@ public class DoubleTerms extends InternalTerms {
for (InternalTerms.Bucket bucket : buckets) {
builder.startObject();
builder.field(CommonFields.KEY, ((Bucket) bucket).term);
if (formatter != null) {
if (formatter != null && formatter != ValueFormatter.RAW) {
builder.field(CommonFields.KEY_AS_STRING, formatter.format(((Bucket) bucket).term));
}
builder.field(CommonFields.DOC_COUNT, bucket.getDocCount());

View File

@ -181,7 +181,7 @@ public class LongTerms extends InternalTerms {
for (InternalTerms.Bucket bucket : buckets) {
builder.startObject();
builder.field(CommonFields.KEY, ((Bucket) bucket).term);
if (formatter != null) {
if (formatter != null && formatter != ValueFormatter.RAW) {
builder.field(CommonFields.KEY_AS_STRING, formatter.format(((Bucket) bucket).term));
}
builder.field(CommonFields.DOC_COUNT, bucket.getDocCount());