@@ -105,9 +105,9 @@ public void testSnapshotAndRestore() throws Exception {
105105 });
106106 assertTrue (e .toString ().contains ("_source only indices can't be searched or filtered" ));
107107
108- e = expectThrows ( SearchPhaseExecutionException . class , () ->
109- client (). prepareSearch ( sourceIdx ). setQuery ( QueryBuilders . termQuery ( "field1" , "bar" )). get ());
110- assertTrue ( e . toString (). contains ( "_source only indices can't be searched or filtered" ) );
108+ // can-match phase pre-filters access to non-existing field
109+ assertEquals ( 0 ,
110+ client (). prepareSearch ( sourceIdx ). setQuery ( QueryBuilders . termQuery ( "field1" , "bar" )). get (). getHits (). getTotalHits (). value );
111111 // make sure deletes do not work
112112 String idToDelete = "" + randomIntBetween (0 , builders .length );
113113 expectThrows (ClusterBlockException .class , () -> client ().prepareDelete (sourceIdx , idToDelete )
@@ -130,9 +130,9 @@ public void testSnapshotAndRestoreWithNested() throws Exception {
130130 SearchPhaseExecutionException e = expectThrows (SearchPhaseExecutionException .class , () ->
131131 client ().prepareSearch (sourceIdx ).setQuery (QueryBuilders .idsQuery ().addIds ("" + randomIntBetween (0 , builders .length ))).get ());
132132 assertTrue (e .toString ().contains ("_source only indices can't be searched or filtered" ));
133- e = expectThrows ( SearchPhaseExecutionException . class , () ->
134- client (). prepareSearch ( sourceIdx ). setQuery ( QueryBuilders . termQuery ( "field1" , "bar" )). get ());
135- assertTrue ( e . toString (). contains ( "_source only indices can't be searched or filtered" ) );
133+ // can-match phase pre-filters access to non-existing field
134+ assertEquals ( 0 ,
135+ client (). prepareSearch ( sourceIdx ). setQuery ( QueryBuilders . termQuery ( "field1" , "bar" )). get (). getHits (). getTotalHits (). value );
136136 // make sure deletes do not work
137137 String idToDelete = "" + randomIntBetween (0 , builders .length );
138138 expectThrows (ClusterBlockException .class , () -> client ().prepareDelete (sourceIdx , idToDelete )
0 commit comments