工具篇-ElasticSearch

ELK背景

Lucene专注于搜索底层的建设,而Elasticsearch专注于企业应用。

关于分词、索引或者底层lucene的介绍可以看下这篇文章:Lucene介绍与使用

1. bool查询

 1 GET xxx/_search
 2 {
 3   "query": {
 4     "bool": {
 5       "must": [
 6         {"term": {
 7           "host.name": {
 8             "value": "xxx"
 9           }
10         }},
11         {"term": {
12           "source": {
13             "value": "/var/log/hadoop-yarn/container/application_1560003017722_1114/container_e05_1560003017722_1114_01_000020/taskmanager.log"
14           }
15         }},
16         {"range": {
17           "@timestamp": {
18             "gte": 1560000017722,
19             "lte": 1560005017722
20           }
21         }}
22       ]
23     }
24   },
25   "size": 100
26 }

2. ES中的数据类型

ES数据类型

3.ilter查询

参考:查询和过滤器上下文

4.index查询

1 GET /_cat/indices
# 结果示例如下:
green open yarn_2019-10-03               CnsEiEXFQIGUDQFFkmp8Yg  6 1  142973560   0    96gb  47.9gb
  • health 
  • status 
  • index 
  • uuid 
  • pri:主分片 rep:副本分片
  • docs.count 文档数
  • docs.deleted 删除文档数
  • store.size 全部分片存储大小
  • pri.store.size 主分片存储大小

注:其他参数意义可通过GET /_cat/indices?help查看

 

posted @ 2019-09-02 21:34  akia开凯  阅读(163)  评论(0编辑  收藏  举报