mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
[TEST] Sort by the _id field instead of _uid field and also assert the sort value.
This commit is contained in:
parent
c89f941ffa
commit
9dd3597f1f
@ -50,7 +50,7 @@ public class ChildrenTests extends ElasticsearchIntegrationTest {
|
||||
assertAcked(
|
||||
prepareCreate("test")
|
||||
.addMapping("article")
|
||||
.addMapping("comment", "_parent", "type=article")
|
||||
.addMapping("comment", "_parent", "type=article", "_id", "index=not_analyzed")
|
||||
);
|
||||
|
||||
List<IndexRequestBuilder> requests = new ArrayList<>();
|
||||
@ -157,7 +157,7 @@ public class ChildrenTests extends ElasticsearchIntegrationTest {
|
||||
.setQuery(matchQuery("randomized", false))
|
||||
.addAggregation(
|
||||
terms("category").field("category").size(0).subAggregation(
|
||||
children("to_comment").childType("comment").subAggregation(topHits("top_comments").addSort("_uid", SortOrder.ASC))
|
||||
children("to_comment").childType("comment").subAggregation(topHits("top_comments").addSort("_id", SortOrder.ASC))
|
||||
)
|
||||
).get();
|
||||
assertSearchResponse(searchResponse);
|
||||
@ -174,7 +174,9 @@ public class ChildrenTests extends ElasticsearchIntegrationTest {
|
||||
assertThat(childrenBucket.getDocCount(), equalTo(2l));
|
||||
TopHits topHits = childrenBucket.getAggregations().get("top_comments");
|
||||
assertThat(topHits.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(topHits.getHits().getAt(0).sortValues()[0].toString(), equalTo("a"));
|
||||
assertThat(topHits.getHits().getAt(0).getId(), equalTo("a"));
|
||||
assertThat(topHits.getHits().getAt(1).sortValues()[0].toString(), equalTo("c"));
|
||||
assertThat(topHits.getHits().getAt(1).getId(), equalTo("c"));
|
||||
|
||||
categoryBucket = categoryTerms.getBucketByKey("b");
|
||||
|
Loading…
x
Reference in New Issue
Block a user