Hello ,
First you need to declare field details as nested. - http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-nested-type.html#mapping-nested-type Then do a bool query with the date range constrain and range constrain Thanks Vineeth On Thu, Sep 11, 2014 at 8:53 AM, 闫旭 <yancey1...@gmail.com> wrote: > Dear All! > > I have a problem with a complex nested query > the docs like this: > _id:1 > { > "detail":[ > { > "date":"2014-09-01", > "price”:50 > }, > { > "date":"2014-09-02", > "price”:100 > }, > { > "date":"2014-09-03", > "price":100 > }, > { > "date":"2014-09-04", > "price":200 > } > ] > > } > _id:2 > { > "detail":[ > { > "date":"2014-09-01", > "price":100 > }, > { > "date":"2014-09-02", > "price":200 > }, > { > "date":"2014-09-03", > "price":300 > }, > { > "date":"2014-09-04", > "price":200 > } > ] > > } > I will filter the docs with “date in [2014-09-01, 2014-09-03] and > sum(price) > 300”. > I only find some way with “aggregation”, but it can only stat the sum of > all docs. > > How Can I solve the problem?? > > > Thanks && Best Regard! > > > -- > 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+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/A98354E4-9C9F-43B2-9310-6355DE3D6F85%40gmail.com > <https://groups.google.com/d/msgid/elasticsearch/A98354E4-9C9F-43B2-9310-6355DE3D6F85%40gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kfRarPNNBctvYfHsk52tjD2rxv18aQGqq3Hz0i_2ZxVQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.