es 学习笔记

order_detail_20190601/order_detail/_search
es 查询
{
  "query": {
    "bool": {
      "must": [
        { "term": { "deptId1": "2493" } },
        { "term": { "split": "" } }
      ]
    }
  },
  "aggs" : {
        "intraday_return" : { "sum" : { "field" : "index1" } }
    }
}

等于sql:

SELECT sum(index1) FROM table WHERE split='' AND deptId1='2493';


{
  "query": {
    "bool": {
      "must": [
        { "term": { "deptId1": "2493" } },
        { "term": { "split": "" } },
        { "term": { "payed": "false" } }
      ],
      "filter": {
        "range": {
          "index1": {
            "gte": 100000
          }
        }
      }
      
    }
  },
  "aggs" : {
        "intraday_return" : { "sum" : { "field" : "index1" } }
    }
}


select sum(index1) from table where deptId1='2493' and split='' and payed='false' and index1>=100000

es 学习资料

https://www.e-learn.cn/content/java/1078247

https://www.sojson.com/blog/81.html

 

Elasticsearch Reference (2.1) 

https://www.elastic.co/guide/en/elasticsearch/reference/2.1/getting-started.html

 

《Elasticsearch基础教程》--翻译

http://blog.csdn.net/cnweike/article/details/33736429

 

《Elasticsearch 权威指南(中文版)》

http://es.xiaoleilu.com/index.html

 

《Elasticsearch权威指南翻译目录》--CSND博客

http://blog.csdn.net/dm_vincent/article/details/46994535/

posted @ 2019-06-01 20:41  诸葛子房  阅读(206)  评论(0编辑  收藏  举报