-
Notifications
You must be signed in to change notification settings - Fork 40
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
Is there some resean the index
and ty
must be static in SearchRequestInner
?
#313
Comments
Hi @wfxr! That The reason we don't currently accept borrowed strings with some shorter lifetime is that we potentially offload request processing to a different thread, so it's simpler to just require values that are guaranteed to live as long as we need, which includes both |
@KodrAus Thanks for your very clear explanation! I follow your instruction and use a owned But can we clone the
|
All those static lifetimes are really hard to work with, with dynamic indexes. Passing a String to the client means moving the index into the client and consequently, if I am going to do thousand of queries there are a lot of unnecessary clones required. I'm also having similar issues when using a I'm probably just going to use raw HTTP requests for this. |
Yeh we could probably do better here and rethink the need for |
Ok, now that we have a single crate to work in we can look at tackling this. There are two routes we could take:
For both of these cases it would be nice to also find a solution to #258 because these builders are becoming pretty complex. |
Both solutions look fine with me! Though I think I prefer the second one as well. Good work! You honestly saved my day with this crate many times by now :) |
Is there some reasons the
index
andty
must be static inSearchRequestInner
?I find it is hard to give
SearchRequestBuilder
a static index name since it only can be computed runtime in some scenario.elastic/src/elastic/src/client/requests/search.rs
Lines 30 to 38 in 216ba8a
The text was updated successfully, but these errors were encountered: