Guys, I'm running the following query to test out one of the use cases:
curl -X GET '0:9200/segmentation/animal/_search?pretty' -d
'{ "query" : {
"has_child" : { "type" : "visit",
"query" : {
"bool" : {
"must" : [
{"term" : { "_parent" : "119000148-5661691" }},
{ "range" : {
"visit_date" : {
"from" : "2003-01-01T00:00:00.000Z",
"to":"2011-11-18T00:00:00.000Z",
"include_lower" : false,
"include_upper" : true}}}]}},
"post_filter" : { "script": { "script": "true == true" }}}}}}}'
<==== Was hoping to use a custom native script to sum across the Visit docs
to compare to sum threshold.
I have Animal parent with child Visit. I am trying to solve this very
important use case for us: Give me all Animals that have had visits between
a certain date range, and those visits must sum to a certain $ amount.
What I would like to do is filter out children records first by the date
range, and then filter by the sum (which is the some across that date-range
collection of docs).
In other words, I would like to return only those Animals in the result
set, which have visits totaling a certain sum, and those visits being
within a certain date range.
Is there a better way to do this?
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/82d03aa4-b003-4e8c-a7b6-8d7129fdfbe0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.