diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/query/planner/physical/node/join/BlockHashJoin.java b/legacy/src/main/java/org/opensearch/sql/legacy/query/planner/physical/node/join/BlockHashJoin.java index 47decf9583..cfb6265e52 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/query/planner/physical/node/join/BlockHashJoin.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/query/planner/physical/node/join/BlockHashJoin.java @@ -17,6 +17,7 @@ import java.util.Map; import java.util.Objects; import org.opensearch.common.Strings; +import org.opensearch.common.xcontent.XContentType; import org.opensearch.index.query.BoolQueryBuilder; import org.opensearch.sql.legacy.query.planner.core.ExecuteParams; import org.opensearch.sql.legacy.query.planner.physical.PhysicalOperator; @@ -97,7 +98,7 @@ private BoolQueryBuilder queryForPushedDownOnConds() { ); if (LOG.isTraceEnabled()) { - LOG.trace("Terms filter optimization: {}", Strings.toString(andQuery)); + LOG.trace("Terms filter optimization: {}", Strings.toString(XContentType.JSON, andQuery)); } orQuery.should(andQuery); } diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/query/planner/physical/node/scroll/Scroll.java b/legacy/src/main/java/org/opensearch/sql/legacy/query/planner/physical/node/scroll/Scroll.java index 875216e3c7..b623e4c1f7 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/query/planner/physical/node/scroll/Scroll.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/query/planner/physical/node/scroll/Scroll.java @@ -9,11 +9,14 @@ import java.util.Arrays; import java.util.Collection; import java.util.Objects; + import org.opensearch.action.search.ClearScrollResponse; import org.opensearch.action.search.SearchResponse; import org.opensearch.client.Client; import org.opensearch.common.Strings; import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.MediaType; +import org.opensearch.common.xcontent.XContentType; import org.opensearch.index.query.BoolQueryBuilder; import org.opensearch.index.query.QueryBuilder; import org.opensearch.search.SearchHit; @@ -94,7 +97,7 @@ public void open(ExecuteParams params) throws Exception { generateNewQueryWithExtraFilter((BoolQueryBuilder) filter)); if (LOG.isDebugEnabled()) { - LOG.debug("Received extra query filter, re-build query: {}", Strings.toString( + LOG.debug("Received extra query filter, re-build query: {}", Strings.toString(XContentType.JSON, request.getRequestBuilder().request().source(), true, true )); } @@ -194,6 +197,6 @@ private String describeTable() { *********************************************/ public String getRequest() { - return Strings.toString(request.getRequestBuilder().request().source()); + return Strings.toString(XContentType.JSON, request.getRequestBuilder().request().source()); } } diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/QueryFunctionsTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/QueryFunctionsTest.java index fd650b310f..9c1328eaa8 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/QueryFunctionsTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/QueryFunctionsTest.java @@ -25,6 +25,7 @@ import org.mockito.Mockito; import org.opensearch.client.Client; import org.opensearch.common.Strings; +import org.opensearch.common.xcontent.XContentType; import org.opensearch.index.query.AbstractQueryBuilder; import org.opensearch.index.query.MultiMatchQueryBuilder; import org.opensearch.search.builder.SearchSourceBuilder.ScriptField; @@ -302,6 +303,6 @@ private String query(String sql) { } private Matcher contains(AbstractQueryBuilder queryBuilder) { - return containsString(Strings.toString(queryBuilder, false, false)); + return containsString(Strings.toString(XContentType.JSON, queryBuilder, false, false)); } }