You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use elastic_lens::{prelude::*, request::search::GeoPoint, response::SearchResults,Error};use serde_json::Value;// Getting the documents back as serde JSON// The client will deserialize the `_source` to any type// that implements for it. See `examples/inventory_item.rs`// for an example.pubasyncfncomplex_search() -> Result<SearchResults<Value>,Error>{let client = create_client()?;letmut search = Search::default();
search.with(field("server.location").within(500).miles().of(GeoPoint::new(12.2,18.9)),);
search.with(field("log.level").has_any_of(["error","warning"]));
search.with(field("log.trace").exists());
search.with(if_any_match(|any| {
any.with(field("service").contains("backend-core"));
any.with(if_all_match(|all| {
all.with(field("service").contains("frontend-core"));
all.with(field("tags").has_any_of(["market-place","registration"]));}));}));Ok(client.search(&search).await?)}
Is your feature request related to a problem? Please describe.
Not a problem, actually, but I would be way more cool, sometimes, to use builder pattern to build queries. Like it was implemented in high-level ES client for dotnet.
Example: https://www.elastic.co/guide/en/elasticsearch/client/net-api/7.17/writing-queries.html
Describe the solution you'd like
Usage of builder pattern, like in dotnet client:
Rust
Describe alternatives you've considered
only using json! macro with the body.
Additional context
some more complex query example.
The text was updated successfully, but these errors were encountered: