remove some more TODOs from ParsedAggregation
This commit is contained in:
parent
9e7b020578
commit
12e8a45de7
|
@ -33,7 +33,6 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public abstract class ParsedAggregation implements Aggregation, ToXContent {
|
public abstract class ParsedAggregation implements Aggregation, ToXContent {
|
||||||
|
|
||||||
//TODO move CommonFields out of InternalAggregation
|
|
||||||
protected static void declareCommonFields(ObjectParser<? extends ParsedAggregation, Void> objectParser) {
|
protected static void declareCommonFields(ObjectParser<? extends ParsedAggregation, Void> objectParser) {
|
||||||
objectParser.declareObject((parsedAgg, metadata) -> parsedAgg.metadata = Collections.unmodifiableMap(metadata),
|
objectParser.declareObject((parsedAgg, metadata) -> parsedAgg.metadata = Collections.unmodifiableMap(metadata),
|
||||||
(parser, context) -> parser.map(), InternalAggregation.CommonFields.META);
|
(parser, context) -> parser.map(), InternalAggregation.CommonFields.META);
|
||||||
|
@ -60,10 +59,7 @@ public abstract class ParsedAggregation implements Aggregation, ToXContent {
|
||||||
//TODO it may make sense to move getType to the Aggregation interface given that we are duplicating it in both implementations
|
//TODO it may make sense to move getType to the Aggregation interface given that we are duplicating it in both implementations
|
||||||
protected abstract String getType();
|
protected abstract String getType();
|
||||||
|
|
||||||
//TODO the only way to avoid duplicating this method is making Aggregation extend ToXContent
|
|
||||||
//and declare toXContent as a default method in it. Doesn't sound like the right thing to do.
|
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
|
||||||
//TODO move TYPED_KEYS_DELIMITER constant out of InternalAggregation
|
|
||||||
// Concatenates the type and the name of the aggregation (ex: top_hits#foo)
|
// Concatenates the type and the name of the aggregation (ex: top_hits#foo)
|
||||||
builder.startObject(String.join(InternalAggregation.TYPED_KEYS_DELIMITER, getType(), name));
|
builder.startObject(String.join(InternalAggregation.TYPED_KEYS_DELIMITER, getType(), name));
|
||||||
if (this.metadata != null) {
|
if (this.metadata != null) {
|
||||||
|
|
Loading…
Reference in New Issue