Add test for NullPointerException in SQS when analyzing text produces null query
This commit is contained in:
parent
1c54033e92
commit
a45e1cc750
|
@ -370,4 +370,31 @@ public class SimpleQueryStringIT extends ESIntegTestCase {
|
|||
assertHitCount(searchResponse, 2L);
|
||||
assertSearchHits(searchResponse, "1", "2");
|
||||
}
|
||||
|
||||
public void testEmptySimpleQueryStringWithAnalysis() throws Exception {
|
||||
// https://github.com/elastic/elasticsearch/issues/18202
|
||||
String mapping = XContentFactory.jsonBuilder()
|
||||
.startObject()
|
||||
.startObject("type1")
|
||||
.startObject("properties")
|
||||
.startObject("body")
|
||||
.field("type", "string")
|
||||
.field("analyzer", "stop")
|
||||
.endObject()
|
||||
.endObject()
|
||||
.endObject()
|
||||
.endObject().string();
|
||||
|
||||
CreateIndexRequestBuilder mappingRequest = client().admin().indices()
|
||||
.prepareCreate("test1")
|
||||
.addMapping("type1", mapping);
|
||||
mappingRequest.execute().actionGet();
|
||||
indexRandom(true, client().prepareIndex("test1", "type1", "1").setSource("body", "Some Text"));
|
||||
refresh();
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch()
|
||||
.setQuery(simpleQueryStringQuery("the*").analyzeWildcard(true).field("body")).get();
|
||||
assertNoFailures(searchResponse);
|
||||
assertHitCount(searchResponse, 0l);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue