Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 0 additions & 67 deletions docs/user/interfaces/protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,73 +208,6 @@ Result set::
"status" : 400
}

OpenSearch DSL
==============

Description
-----------

The plugin returns original response from OpenSearch in JSON. Because this is the native response from OpenSearch, extra efforts are needed to parse and interpret it.

Example
-------

SQL query::

>> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql?format=json -d '{
"query" : "SELECT firstname, lastname, age FROM accounts ORDER BY age LIMIT 2"
}'

Result set::

{
"_shards" : {
"total" : 5,
"failed" : 0,
"successful" : 5,
"skipped" : 0
},
"hits" : {
"hits" : [
{
"_index" : "accounts",
"_type" : "_doc",
"_source" : {
"firstname" : "Nanette",
"age" : 28,
"lastname" : "Bates"
},
"_id" : "13",
"sort" : [
28
],
"_score" : null
},
{
"_index" : "accounts",
"_type" : "_doc",
"_source" : {
"firstname" : "Amber",
"age" : 32,
"lastname" : "Duke"
},
"_id" : "1",
"sort" : [
32
],
"_score" : null
}
],
"total" : {
"value" : 4,
"relation" : "eq"
},
"max_score" : null
},
"took" : 100,
"timed_out" : false
}

CSV Format
==========

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
import org.junit.Ignore;
import org.junit.Test;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class AggregationIT extends SQLIntegTestCase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
import org.junit.Test;
import org.opensearch.sql.legacy.exception.SqlParseException;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class DateFormatIT extends SQLIntegTestCase {

private static final String SELECT_FROM =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.json.JSONObject;
import org.junit.Ignore;
import org.junit.Test;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
Expand All @@ -25,6 +26,9 @@
import org.opensearch.core.xcontent.XContentParser;
import org.opensearch.search.SearchHit;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class DateFunctionsIT extends SQLIntegTestCase {

private static final String FROM = "FROM " + TestsConstants.TEST_INDEX_ONLINE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.junit.rules.ExpectedException;
import org.opensearch.client.ResponseException;

/** Tests to cover requests with "?format=csv" parameter */
public class GetEndpointQueryIT extends SQLIntegTestCase {

@Rule public final ExpectedException rule = ExpectedException.none();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

/** Test new hash join algorithm by comparison with old implementation. */
@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class HashJoinIT extends SQLIntegTestCase {

/** Hint to use old join algorithm */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
import org.hamcrest.Matcher;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Ignore;
import org.junit.Test;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class HavingIT extends SQLIntegTestCase {

private static final String SELECT_FROM_WHERE_GROUP_BY =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.io.IOException;
import java.util.Map;
import org.json.JSONObject;
import org.junit.Ignore;
import org.junit.Test;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
Expand All @@ -23,6 +24,9 @@
import org.opensearch.search.SearchHit;
import org.opensearch.search.SearchHits;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class JSONRequestIT extends SQLIntegTestCase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import org.junit.Ignore;
import org.junit.Test;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class JoinIT extends SQLIntegTestCase {

private static final String USE_NL_HINT = " /*! USE_NL*/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import com.fasterxml.jackson.core.JsonFactory;
import java.io.IOException;
import org.junit.Ignore;
import org.junit.Test;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
Expand All @@ -20,6 +21,9 @@
import org.opensearch.core.xcontent.XContentParser;
import org.opensearch.search.SearchHit;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class MathFunctionsIT extends SQLIntegTestCase {

private static final String FROM = "FROM " + TestsConstants.TEST_INDEX_ACCOUNT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class MultiQueryIT extends SQLIntegTestCase {

private static final String MINUS_SCROLL_DEFAULT_HINT =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
* 6) Verification for conditions mixed with regular and nested fields
* </pre>
*/
@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class NestedFieldQueryIT extends SQLIntegTestCase {

private static final String FROM =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
import java.io.IOException;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Ignore;
import org.junit.Test;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class OrderIT extends SQLIntegTestCase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.io.IOException;
import java.util.Locale;
import org.json.JSONObject;
import org.junit.Ignore;
import org.junit.Test;
import org.opensearch.client.Request;
import org.opensearch.client.RequestOptions;
Expand All @@ -26,6 +27,9 @@ protected void init() throws Exception {
wipeAllClusterSettings();
}

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
@Test
public void sqlEnableSettingsTest() throws IOException {
loadIndex(Index.ACCOUNT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

// Refer to https://www.elastic.co/guide/en/elasticsearch/reference/6.5/integration-tests.html
// for detailed OpenSearchIntegTestCase usages doc.
@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class PreparedStatementIT extends SQLIntegTestCase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.hamcrest.FeatureMatcher;
import org.hamcrest.Matcher;
import org.json.JSONObject;
import org.junit.Ignore;
import org.junit.Test;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
Expand All @@ -35,6 +36,9 @@
import org.opensearch.search.SearchHit;
import org.opensearch.sql.legacy.utils.StringUtils;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class QueryFunctionsIT extends SQLIntegTestCase {

private static final String SELECT_ALL = "SELECT *";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
import org.opensearch.core.rest.RestStatus;
import org.opensearch.sql.legacy.utils.StringUtils;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class QueryIT extends SQLIntegTestCase {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
import org.opensearch.search.SearchHit;
import org.opensearch.search.SearchHits;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
/** Created by allwefantasy on 8/25/16. */
public class SQLFunctionsIT extends SQLIntegTestCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ protected synchronized void loadIndex(Index index) throws IOException {
}

protected Request getSqlRequest(String request, boolean explain) {
return getSqlRequest(request, explain, "json");
return getSqlRequest(request, explain, "jdbc");
}

protected Request getSqlRequest(String request, boolean explain, String requestType) {
Expand Down Expand Up @@ -344,7 +344,7 @@ protected Request buildGetEndpointRequest(final String sqlQuery) {

final String requestUrl =
String.format(
Locale.ROOT, "%s?sql=%s&format=%s", QUERY_API_ENDPOINT, urlEncodedQuery, "json");
Locale.ROOT, "%s?sql=%s&format=%s", QUERY_API_ENDPOINT, urlEncodedQuery, "jdbc");
return new Request("GET", requestUrl);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
import java.io.IOException;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class ShowIT extends SQLIntegTestCase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.Set;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
Expand All @@ -21,6 +22,9 @@
import org.opensearch.search.SearchHit;
import org.opensearch.search.SearchHits;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class SourceFieldIT extends SQLIntegTestCase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
import org.opensearch.client.ResponseException;
import org.opensearch.sql.legacy.utils.StringUtils;

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
public class SubqueryIT extends SQLIntegTestCase {

@Rule public final ExpectedException exceptionRule = ExpectedException.none();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Ignore;
import org.junit.Test;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
Expand Down Expand Up @@ -157,6 +158,9 @@ public void isnullShouldPassJDBC() throws IOException {
assertEquals("boolean", response.query("/schema/0/type"));
}

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
@Test
public void isnullWithNotNullInputTest() throws IOException {
assertThat(
Expand Down Expand Up @@ -188,6 +192,9 @@ public void isnullWithNullInputTest() {
rows(LITERAL_TRUE.value(), LITERAL_FALSE.value()));
}

@Ignore(
"OpenSearch DSL format is deprecated in 3.0.0. Ignore legacy IT that relies on json format"
+ " response for now. Need to decide what to do with these test cases.")
@Test
public void isnullWithMathExpr() throws IOException {
assertThat(
Expand Down
Loading
Loading