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

[Feature Request] Improve performance of sort by _id #13709

Open
dvjyothsna opened this issue May 16, 2024 · 3 comments
Open

[Feature Request] Improve performance of sort by _id #13709

dvjyothsna opened this issue May 16, 2024 · 3 comments
Labels
enhancement Enhancement or improvement to existing feature or request Search:Performance

Comments

@dvjyothsna
Copy link
Contributor

Is your feature request related to a problem? Please describe

We have a usecase where we rely on sort by _id to paginate and _id is the only field we can deterministically sort on. One of the workarounds is to copy the _id field into a doc value field. But it doesn't work for our usecase since ther user trying to paginate has readonly access. Another use case is where users can use custom ids and sort on the custom ids. Given the use cases, Is there a plan to optimize sort by _id?

Describe the solution you'd like

Optimize search performance for sort by _id

Related component

Search:Performance

Describe alternatives you've considered

No response

Additional context

No response

@dvjyothsna dvjyothsna added enhancement Enhancement or improvement to existing feature or request untriaged labels May 16, 2024
@dvjyothsna
Copy link
Contributor Author

@msfroh

@dvjyothsna
Copy link
Contributor Author

@saratvemulapalli

@msfroh
Copy link
Collaborator

msfroh commented May 20, 2024

@dvjyothsna -- can you please clarify what the problem is that needs solving?

From what I can see, we do support sorting, but we output this deprecation message:

"Loading the fielddata on the _id field is deprecated and will be removed in future versions. "

One of the workarounds is to copy the _id field into a doc value field. But it doesn't work for our usecase since ther user trying to paginate has readonly access.

The efficient way to support sorting on a field is to enable doc values on that field. I don't think we would ever enable doc values on the _id field by default, since it would increase the size of the index for all users, whether they want to sort on _id or not. We could add a mapping flag to store a doc value for the _id field, but that wouldn't help your readonly user (and would be functionally equivalent to copying the _id field into another field with doc values enabled).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request Search:Performance
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants