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
Range queries with elastic4s #450
Comments
You can do a range query or range filter using the DSL: object RangeQuery extends App {
import com.sksamuel.elastic4s.ElasticDsl._
import com.sksamuel.elastic4s.ElasticClient
val esClient = ElasticClient.local
// range query
esClient.execute {
search in "index" / "type" query {
rangeQuery("field") from "now-30d" to "now"
}
}
// range filter
esClient.execute {
search in "index" / "type" query {
filteredQuery query {
matchall
} filter {
rangeFilter("field") from "now-30d" to "now"
}
}
}
} |
Hi, Thanks a lot, it works as expected. thanks and regards |
Do you have a test case I can use to see what's happening? On 12 December 2015 at 04:21, budzynski notifications@github.com wrote:
|
Sorry, I thought it was not working but after reading some elastic documentation I finally made it work - it just took me a while to figure out the proper construction. Maybe it was a confusing transition from 1.x APIs. Thanks for your response though. For all who are looking for some reference - here is how to apply a range filter on time and term filter on symbol value with v. 2.1.1:
|
Hi,
I was trying to do a range query as explained in the elasticsearch https://www.elastic.co/guide/en/elasticsearch/reference/2.0/query-dsl-range-query.html
The issue is that I dont find a matching DSL in the elastic4s. So my question is how to do date range search in elastic4s?
Should the way forward is to use raw query? I tried with raw query for the date range search and it seems to work but combining that with other query and creating a json dynamically doesnt looks the straightforward way to get it working.
Any help on this issue is greatly appreciated.
thanks and regards
Ganesh
The text was updated successfully, but these errors were encountered: