Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve Alias Issues in Legacy SQL with Filters #2960

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aparajita31pandey
Copy link

@aparajita31pandey aparajita31pandey commented Sep 1, 2024

Description

Alias query in legacy SQL which had filters to it didn't work . This diff addresses that issue. This diff derives index name from alias, for legacy sql queries having filters to it. I plan to add testcases to this PR too

Before the change

curl -X POST "localhost:9200/_plugins/_sql" -H 'Content-Type: application/json' -d '{
  "query": "SELECT * FROM my-alias",
  "fetch_size": 1,
   "filter" : {
    "term" : {
      "field2" : "Sample keyword2"
    }
  }
}'
{
  "error": {
    "reason": "There was internal problem at backend",
    "details": "Index type [my-alias] does not exist",
    "type": "IllegalArgumentException"
  },
  "status": 500
}

After the change:

curl -X POST "localhost:9200/_plugins/_sql" -H 'Content-Type: application/json' -d '{
  "query": "SELECT * FROM my-alias",
  "fetch_size": 1,
   "filter" : {
    "term" : {
      "another_field" : "hello"
    }
  }
}'
{
  "schema": [
    {
      "name": "new_field",
      "type": "text"
    },
    {
      "name": "another_field",
      "type": "keyword"
    }
  ],
  "total": 1,
  "datarows": [[
    "Some text",
    "hello"
  ]],
  "size": 1,
  "status": 200

Related Issues

Resolves #2912
#1398

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@aparajita31pandey aparajita31pandey changed the title Fixpagination alias WIP: Fixpagination alias Sep 1, 2024
@aparajita31pandey aparajita31pandey changed the title WIP: Fixpagination alias WIP: Fix Pagination alias on Legacy SQL Sep 1, 2024
@aparajita31pandey aparajita31pandey changed the title WIP: Fix Pagination alias on Legacy SQL Fix Pagination alias on Legacy SQL Sep 2, 2024
@aparajita31pandey aparajita31pandey changed the title Fix Pagination alias on Legacy SQL Resolve Alias Issues in Legacy SQL with Filters Sep 4, 2024
@ctellechea2001
Copy link

@aparajita31pandey Do you know when could be this PR reviewed and merged to fix this issue that we have reported?
#2912

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Pagination of index aliases is not supported - Re-opened
2 participants