[TEST] resolved warning in IndexedScriptTests
This commit is contained in:
parent
19418749e4
commit
4dab138db7
|
@ -38,7 +38,7 @@ public class IndexedScriptTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void testFieldIndexedScript() throws ExecutionException, InterruptedException{
|
||||
List<IndexRequestBuilder> builders = new ArrayList();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
builders.add(client().prepareIndex(ScriptService.SCRIPT_INDEX, "groovy", "script1").setSource("{" +
|
||||
"\"script\":\"2\""+
|
||||
"}").setTimeout(TimeValue.timeValueSeconds(randomIntBetween(2,10))));
|
||||
|
@ -57,11 +57,10 @@ public class IndexedScriptTests extends ElasticsearchIntegrationTest {
|
|||
builders.add(client().prepareIndex("test", "scriptTest", "4").setSource("{\"theField\":\"foo 4\"}"));
|
||||
builders.add(client().prepareIndex("test", "scriptTest", "5").setSource("{\"theField\":\"bar\"}"));
|
||||
|
||||
indexRandom(true,builders);
|
||||
SearchResponse searchResponse;
|
||||
indexRandom(true, builders);
|
||||
String query = "{ \"query\" : { \"match_all\": {}} , \"script_fields\" : { \"test1\" : { \"script_id\" : \"script1\", \"lang\":\"groovy\" }, \"test2\" : { \"script_id\" : \"script2\", \"lang\":\"groovy\", \"params\":{\"factor\":3} }}, size:1}";
|
||||
searchResponse = client().prepareSearch().setSource(query).setIndices("test").setTypes("scriptTest").get();
|
||||
assertHitCount(searchResponse,5);
|
||||
SearchResponse searchResponse = client().prepareSearch().setSource(query).setIndices("test").setTypes("scriptTest").get();
|
||||
assertHitCount(searchResponse, 5);
|
||||
assertTrue(searchResponse.getHits().hits().length == 1);
|
||||
SearchHit sh = searchResponse.getHits().getAt(0);
|
||||
assertThat((Integer)sh.field("test1").getValue(), equalTo(2));
|
||||
|
|
Loading…
Reference in New Issue