opensearch-project / opensearch-project/sql

[BUG] JSON format throw exception on legacy engine.

Open
#440 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug legacy SQL
Dominant language
Java
Stars
176
Forks
229
Avg merge
2d 21h
Merged PRs (30d)
43

Description

Describe the bug
A clear and concise description of what the bug is.

To Reproduce

PUT /test-00001?pretty 
{
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "properties": {
      "day": { "type": "date" },
      "region": { "type": "keyword" },
      "host": { "type": "keyword" },
      "errors": { "type": "integer" }      
    }
  }
}

PUT /_bulk
{ "index" : { "_index" : "test-00001", "_id" : "1" } }
{ "day": "2021-01-03", "region": "iad", "host": "h1", "errors": 2}
{ "index" : { "_index" : "test-00001", "_id" : "2"} }
{ "day": "2021-01-03", "region": "iad", "host": "h2", "errors": 3}

### Success
POST /_plugins/_sql
{
  "query": "SELECT * FROM issue-395 WHERE lower(region) LIKE '%iad%'"
}

### Exception
POST /_plugins/_sql?format=json
{
  "query": "SELECT * FROM issue-395 WHERE lower(region) LIKE '%iad%'"
}

Expected behavior
https://github.com/opensearch-project/sql/blob/main/docs/user/interfaces/protocol.rst#opensearch-dsl

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the request in the issue against the legacy engine, then read the linked protocol.rst OpenSearch DSL section to confirm the expected JSON behavior. Done means the same SQL query with format=json returns a valid response instead of throwing an exception; the issue does not name a source file or test to update.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.