[FEATURE] _routing suppport

Open
#5,859 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
java
Domain
search

Research direction

Start with feature #1805, which the issue says added parsing of _routing in SQL queries, and find where that value is currently consumed when the query is sent to OpenSearch. The open question is how strict the query shape must be before routing applies, which the maintainers have not decided. Done means a query with _routing reaches only the matching shards, shown by a test, and the design choice is agreed in the thread first.

Written by the indexing model from the issue text.

Description

enhancement

Is your feature request related to a problem?
Feature #1805 added support for including _routing in a query, but omitted a significant piece of that functionality, namely actually routing the request to only those specific shards. The sql plugin is incredibly useful, but being unable to use shard routing makes it perform rather poorly on our cluster. Each tenant has specific shards, and running the sql queries across the entire cluster instead of the tenant specific shards adds lots of unnecessary time to the queries.

What solution would you like?
When _routing is included in a sql query, route the opensearch query to the appropriate shards instead of the entire cluster. I'm fine with very strict query structure (e.g. requiring this expression to be the first in the WHERE clause or something like that)

What alternatives have you considered?
We are probably going to end up with using an alias per tenant in our cluster because using the sql query with the alias seems to do the routing correctly. however, that adds a lot of extra maintenance burden (an alias per tenant), and we are unsure how that will scale as the number of tenants grows.

Do you have any additional context?
Nope

Dominant language
Java
Stars
176
Forks
237
Avg merge
2d 12h
Merged PRs (30d)
34

Getting set up

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.

More from opensearch-project/sql

All issues in opensearch-project/sql

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.