forked from opensearch-project/opensearch-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix serialization of nested aggregates under `SingleBucketAggregateBa…
…se` (opensearch-project#1350) * Add failing test Signed-off-by: Thomas Farr <[email protected]> * Fix Signed-off-by: Thomas Farr <[email protected]> --------- Signed-off-by: Thomas Farr <[email protected]> (cherry picked from commit 29381c0)
- Loading branch information
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...c/test/java/org/opensearch/client/opensearch/_types/aggregations/FilterAggregateTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.client.opensearch._types.aggregations; | ||
|
||
import org.junit.Test; | ||
import org.opensearch.client.opensearch.model.ModelTestCase; | ||
|
||
public class FilterAggregateTest extends ModelTestCase { | ||
@Test | ||
public void serializesNestedAggregates() { | ||
String json = "{\"sum#l2_result\":{\"value\":1.0},\"doc_count\":1}"; | ||
FilterAggregate aggregate = fromJson(json, FilterAggregate._DESERIALIZER); | ||
assertEquals(json, toJson(aggregate)); | ||
} | ||
} |