Thank you !  But nested bool query can not plus all price with the data range. 
how  can i do this??

Thx again.

Thanks && Best Regard!

在 2014年9月11日,12:04,vineeth mohan <[email protected]> 写道:

> 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, 闫旭 <[email protected]> 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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elasticsearch/A98354E4-9C9F-43B2-9310-6355DE3D6F85%40gmail.com.
> 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 [email protected].
> 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.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/BAA9C6D6-8060-4F4E-B2F0-7764EAD2BCDB%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to