Modified test to make failures clearer
Added shard failure check when sorting on unmapped field, could be any SearchPhaseExecutionException otherwise (e.g. missing shards)
This commit is contained in:
parent
f2f70a415a
commit
60bddc28eb
|
@ -813,13 +813,14 @@ public class SimpleSortTests extends AbstractSharedClusterTest {
|
|||
@Test
|
||||
public void testIgnoreUnmapped() throws Exception {
|
||||
createIndex("test");
|
||||
ensureYellow();
|
||||
|
||||
client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject()
|
||||
.field("id", "1")
|
||||
.field("i_value", -1)
|
||||
.field("d_value", -1.1)
|
||||
.endObject()).execute().actionGet();
|
||||
ensureYellow();
|
||||
|
||||
logger.info("--> sort with an unmapped field, verify it fails");
|
||||
try {
|
||||
SearchResponse result = client().prepareSearch()
|
||||
|
@ -828,8 +829,12 @@ public class SimpleSortTests extends AbstractSharedClusterTest {
|
|||
.execute().actionGet();
|
||||
assertThat("Expected exception but returned with", result, nullValue());
|
||||
} catch (SearchPhaseExecutionException e) {
|
||||
//we check that it's a parse failure rather than a different shard failure
|
||||
for (ShardSearchFailure shardSearchFailure : e.shardFailures()) {
|
||||
assertThat(shardSearchFailure.reason(), containsString("Parse Failure [No mapping found for [kkk] in order to sort on]"));
|
||||
}
|
||||
}
|
||||
ensureYellow();
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch()
|
||||
.setQuery(matchAllQuery())
|
||||
.addSort(SortBuilders.fieldSort("kkk").ignoreUnmapped(true))
|
||||
|
|
Loading…
Reference in New Issue