opensearch-project / opensearch-project/sql

[BUG] Index patterns in nested collection queries

Open
#1,542 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What is the bug?

Using wildcards in index name works for simple queries only. Self-joined queries fail. More details in index-patterns-for-querying-nested-collection discussion:

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Use sample data from:
    https://opensearch.org/docs/latest/search-plugins/sql/sql/partiql/

Map array of object as nested type.

  1. Query nested collection using index pattern employees* :
SELECT e.name AS employeeName,
       p.name AS projectName
FROM employees* AS e,
       e.projects AS p
WHERE p.name LIKE '%security%'

Result:

{
  "error": {
    "reason": "There was internal problem at backend",
    "details": "Index type [employees*] does not exist",
    "type": "IllegalArgumentException"
  },
  "status": 500
}

What is the expected behavior?
Search all indexes matching a given pattern

What is your host/environment?
2.6.0

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 with the SQL/PartiQL nested-collection example and reproduce the query against the sample data using the employees* index pattern. Trace how index patterns are handled for the self-joined nested query. Done means the query searches all matching indexes instead of returning the "Index type [employees*] does not exist" error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.