Elasticsearch如何在聚合查询中获取Sum

时间:2017-02-01 16:00:38

标签: elasticsearch

我正在研究Elasticsearch 1.5.2。我存储了这些产品:" sel 1"," sel 2"," haricot 1"和" haricot 2"

{"@timestamp":"2015-x", "message":"bla", "r":{"analyzed":"blub", "query": {"where":"9999"}}}
{"@timestamp":"2015-x", "message":"blub", "r":{"analyzed":"bla", "query": {"where":"1111"}}}

我做一个查询以获得最便宜的" prix en€/ kg"产品sel和最便宜的" prix en€/ kg"产品扁豆。

  POST /test/prod
{
    "titre": "sel 1",
    "prix en €": 2.49 ,
    "prix en €/kg": 5.20 

}

POST /test/prod
{
    "titre": "sel 2",
    "prix en €": 2 ,
    "prix en €/kg": 4.3 

}

POST /test/prod
{
    "titre": "haricot 1",
    "prix en €": 14 ,
    "prix en €/kg": 0.85 

}

POST /test/prod
{
    "titre": "haricot 2",
    "prix en €": 36 ,
    "prix en €/kg": 4 

}

有效。现在我想得到" prix en€" (最便宜的" sel" +最便宜的"扁豆")。那我怎么能这样做呢?

0 个答案:

没有答案