Adding test for parsing sort on single fields as list

This commit is contained in:
Christoph Büscher 2016-03-23 15:27:53 +01:00
parent 41ddc6fa3f
commit e319985d93
1 changed files with 7 additions and 0 deletions

View File

@ -82,6 +82,13 @@ public class SortBuilderTests extends ESTestCase {
sortBuilder = result.get(0);
assertEquals(new FieldSortBuilder("field1"), sortBuilder);
// one element array, see https://github.com/elastic/elasticsearch/issues/17257
json = "{ \"sort\" : [\"field1\"] }";
result = parseSort(json);
assertEquals(1, result.size());
sortBuilder = result.get(0);
assertEquals(new FieldSortBuilder("field1"), sortBuilder);
json = "{ \"sort\" : { \"_doc\" : \"" + order + "\" }}";
result = parseSort(json);
assertEquals(1, result.size());