Analysis : Fix no response from Analyze API without specified index

Fix error handling in TransportSingleShardAction without shardIt

Closes #15148
This commit is contained in:
Jun Ohtani 2015-12-16 00:01:31 +09:00
parent 445be98e4c
commit 267cd65506
2 changed files with 16 additions and 1 deletions

View File

@ -177,7 +177,7 @@ public abstract class TransportSingleShardAction<Request extends SingleShardRequ
@Override
public void handleException(TransportException exp) {
perform(exp);
listener.onFailure(exp);
}
});
} else {

View File

@ -503,4 +503,19 @@ public class AnalyzeActionIT extends ESIntegTestCase {
}
public void testNonExistTokenizer() {
try {
AnalyzeResponse analyzeResponse = client().admin().indices()
.prepareAnalyze("this is a test")
.setAnalyzer("not_exist_analyzer")
.get();
fail("shouldn't get here");
} catch (Throwable t) {
assertThat(t, instanceOf(IllegalArgumentException.class));
assertThat(t.getMessage(), startsWith("failed to find analyzer"));
}
}
}