Skip to content

[BUG] Enhance OS value parsing #3001

Open
@bugmakerrrrrr

Description

@bugmakerrrrrr

What is the bug?
In OS, the numeric/boolean fields can be indexed in text format, and the string field can be indexed in numeric format, but the sql plugin cannot parse these value correctly.

How can one reproduce the bug?

PUT test
{
  "mappings": {
    "properties": {
      "field1": {
        "type": "long"
      },
      "field2": {
        "type": "boolean"
      }
    }
  }
}

POST test/_bulk?refresh=true
{"index": {}}
{"field1": ["1", 1], "field2": ["true", true]}
{"index": {}}
{"field1": "1", "field2": "true"}

POST _plugins/_sql
{
  "query": "select field1, field2 from test"
}

#response
{
  "schema": [
    {
      "name": "field1",
      "type": "long"
    },
    {
      "name": "field2",
      "type": "boolean"
    }
  ],
  "datarows": [
    [
      "1",
      "true"
    ],
    [
      0,
      false
    ]
  ],
  "total": 2,
  "size": 2,
  "status": 200
}

Metadata

Metadata

Assignees

Labels

PPLPiped processing languageSQLbugSomething isn't working

Type

No type

Projects

Status

Not Started

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions