@@ -35,6 +35,13 @@ protected void populateData(Client tc) {
3535 new IndexRequest ("deals" ).id ("1" ).setRefreshPolicy (RefreshPolicy .IMMEDIATE ).source ("{\" amount\" : 1500}" , XContentType .JSON )
3636 ).actionGet ();
3737
38+ tc .index (
39+ new IndexRequest ("terms" ).id ("0" ).setRefreshPolicy (RefreshPolicy .IMMEDIATE ).source ("{\" foo\" : \" bar\" }" , XContentType .JSON )
40+ ).actionGet ();
41+ tc .index (
42+ new IndexRequest ("terms" ).id ("1" ).setRefreshPolicy (RefreshPolicy .IMMEDIATE ).source ("{\" foo\" : \" baz\" }" , XContentType .JSON )
43+ ).actionGet ();
44+
3845 try {
3946 Thread .sleep (3000 );
4047 } catch (InterruptedException e ) {
@@ -44,6 +51,7 @@ protected void populateData(Client tc) {
4451 System .out .println ("q" );
4552 System .out .println (Strings .toString (XContentType .JSON , tc .search (new SearchRequest ().indices (".opendistro_security" )).actionGet ()));
4653 tc .search (new SearchRequest ().indices ("deals" )).actionGet ();
54+ tc .search (new SearchRequest ().indices ("terms" )).actionGet ();
4755 }
4856
4957 @ Test
@@ -250,6 +258,32 @@ public void testDls() throws Exception {
250258
251259 }
252260
261+ @ Test
262+ public void testDlsWithTermsQuery () throws Exception {
263+
264+ setup ();
265+
266+ HttpResponse res ;
267+
268+ Assert .assertEquals (
269+ HttpStatus .SC_OK ,
270+ (res = rh .executeGetRequest ("/terms/_search?pretty" , encodeBasicHeader ("dept_manager" , "password" ))).getStatusCode ()
271+ );
272+ Assert .assertEquals (res .getTextFromJsonBody ("/hits/total/value" ), "1" );
273+ Assert .assertEquals (res .getTextFromJsonBody ("/_shards/failed" ), "0" );
274+
275+ Assert .assertEquals (
276+ HttpStatus .SC_OK ,
277+ (res = rh .executeGetRequest ("/terms/_doc/0" , encodeBasicHeader ("dept_manager" , "password" ))).getStatusCode ()
278+ );
279+ Assert .assertEquals (res .getTextFromJsonBody ("/_source/foo" ), "bar" );
280+
281+ Assert .assertEquals (
282+ HttpStatus .SC_NOT_FOUND ,
283+ rh .executeGetRequest ("/terms/_doc/1" , encodeBasicHeader ("dept_manager" , "password" )).getStatusCode ()
284+ );
285+ }
286+
253287 @ Test
254288 public void testNonDls () throws Exception {
255289
0 commit comments