@@ -584,6 +584,7 @@ private void traverse() throws IOException, ValidationException {
584584 // Prepare to collect attributes from the results of these queries as the inputs to subsequent queries.
585585 Map <String , Attribute > nextInputAttributes = new TreeMap <>();
586586 Boolean newHits = false ;
587+ int _query = 0 ;
587588
588589 // Construct a query for each index that maps to a resolver.
589590 for (String indexName : this .input .model ().indices ().keySet ()) {
@@ -976,7 +977,7 @@ else if (!resolversClause.isEmpty())
976977 }
977978 String filtersLogged = String .join ("," , filtersLoggedList );
978979 String searchLogged = "{\" request\" :" + query + ",\" response\" :" + responseDataCopyObj + "}" ;
979- String logged = "{\" _hop\" :" + this .hop + ",\" _index\" :\" " + indexName + "\" ,\" filters\" :{" + filtersLogged + "},\" search\" :" + searchLogged + "}" ;
980+ String logged = "{\" _hop\" :" + this .hop + ",\" _query \" :" + _query + ", \" _index\" :\" " + indexName + "\" ,\" filters\" :{" + filtersLogged + "},\" search\" :" + searchLogged + "}" ;
980981 this .queries .add (logged );
981982 }
982983
@@ -1048,6 +1049,7 @@ else if (!resolversClause.isEmpty())
10481049 docObjNode .remove ("_score" );
10491050 docObjNode .remove ("fields" );
10501051 docObjNode .put ("_hop" , this .hop );
1052+ docObjNode .put ("_query" , _query );
10511053 if (this .includeAttributes ) {
10521054 ObjectNode docAttributesObjNode = docObjNode .putObject ("_attributes" );
10531055 for (String attributeName : docAttributes .keySet ()) {
@@ -1127,6 +1129,7 @@ else if (input.model().matchers().containsKey(matcherName))
11271129 this .hits .add (doc .toString ());
11281130 }
11291131 }
1132+ _query ++;
11301133 }
11311134
11321135 // Stop traversing if we've reached max depth.
0 commit comments