请问当结果集比较大或者bucket数量太多时,使用dateHistogram,terms进行聚合分析如何优化?
Elasticsearch • laoyang360 回复了问题 • 4 人关注 • 2 个回复 • 5872 次浏览 • 2018-02-11 19:38
社区日报 第186期 (2018-02-11)
社区日报 • 至尊宝 发表了文章 • 0 个评论 • 1726 次浏览 • 2018-02-11 09:06
http://t.cn/RRbOoII
2.分析3个月的未读电子邮件。
http://t.cn/RRbMyR8
3.(自备梯子)使用ELK堆栈实现客户智能。
http://t.cn/RRbx2XL
编辑:至尊宝
归档:https://elasticsearch.cn/article/497
订阅:https://tinyletter.com/elastic-daily
logstash 日志里老是有错误
Logstash • haiying 回复了问题 • 3 人关注 • 3 个回复 • 9801 次浏览 • 2018-06-29 12:03
在使用es2.4版本过程中关于映射的问题!
回复Elasticsearch • ajaq454 回复了问题 • 1 人关注 • 1 个回复 • 2308 次浏览 • 2018-02-10 15:44
推荐indies_view 插件
Kibana • truman.p.du 发表了文章 • 1 个评论 • 3234 次浏览 • 2018-02-10 15:05
indies_view
[https://github.com/TrumanDu/indices_view](https://github.com/TrumanDu/indices_view)
An awesome kibana plugin for view indies!
这个是一个可以查看indices 相关信息的kibana plugin ,欢迎大家使用,或者提出宝贵的经验
---
Screenshots
Reg pattern
```
- /[^a-z] $/
- /[\d]{4}[-|.|/][\d]{1,2}[-|.|/][\d]{1,2}/
```
Development
See the [kibana contributing guide](https://github.com/elastic/kib ... ING.md) for instructions setting up your development environment. Once you have completed that, use the following npm tasks.
npm start
Start kibana and have it include this plugin
npm start -- --config kibana.yml
You can pass any argument that you would normally send tobin/kibana
by putting them after--
when runningnpm start
npm run build
Build a distributable archive
npm run test:browser
Run the browser tests in a real web browser
npm run test:server
Run the server tests using mocha
For more information about any of these commands runnpm run ${task} -- --help
.
Deploy
important : edit this plugin version and kibana.version to you kibana version in package.json
npm install
npm run build
Build a distributable archive
Install
- cp to docker container
$ sudo docker cp ****.zip id:/****.zip
- install to kibana
$bin/kibana-plugin install file:///****.zip
社区日报 第185期 (2018-02-10)
社区日报 • elk123 发表了文章 • 0 个评论 • 1974 次浏览 • 2018-02-10 11:29
- Elasticsearch与Hbase特性对比。
http://t.cn/RRyM1vm - 将Elasticsearch作为Hive的存储?
http://t.cn/RRyxDNZ - 基于Elasticsearch实现搜索推荐
http://t.cn/RRyJiHx
kibana使用geoip插件展示地图热力图
Kibana • ziyou 发表了文章 • 10 个评论 • 26066 次浏览 • 2018-02-09 16:56
上图是我们最终的地图效果。
总体步骤:
一、使用logstash geoip插件解析IP字段;
二、配置geoip.location字段为geo_point类型。
三、使用kibana的Coordinate map作图。
具体步骤:
一、解析IP字段
使用logstash的geoip插件 logstash-filter-geoip 解析IP字段,需要在logstash的配置文件中配置geoip的解析配置,配置如下:
<br /> geoip {<br /> source => "ip" //需要解析的IP地址<br /> }<br />
解析出的效果如下:
<br /> "geoip": {<br /> "city_name": "Wuhan",<br /> "timezone": "Asia/Shanghai",<br /> "ip": "117.136.52.200",<br /> "latitude": 30.5801,<br /> "country_name": "China",<br /> "country_code2": "CN",<br /> "continent_code": "AS",<br /> "country_code3": "CN",<br /> "region_name": "Hubei",<br /> "location": {<br /> "lon": 114.2734,<br /> "lat": 30.5801<br /> },<br /> "region_code": "42",<br /> "longitude": 114.2734<br /> }<br /> <br />
备注:这个只是geoip的配置,解析日志的时候需要先解析出ip字段
二、配置geoip字段类型
IP经过logstash解析后就可以使用IP的所有解析信息了,但是如果想要在kibana中作图,就必须把geoip里面的相应信息配置成相应的字段类型,才能够被kibana识别,然后经过聚合作图。
需要配置的字段:geoip.location
需要配置的类型:geo_point
在mapping中的配置为:
<br /> "geoip" : {<br /> "properties" : {<br /> "location" : {<br /> "type" : "geo_point",<br /> "ignore_malformed": "true" <br /> }<br /> }<br /> }<br />
备注1:
ignore_malformed 如果true,格式错误的地理位置被忽略。如果false(默认),格式错误的地理位置引发异常并拒绝整个文档。
此字段需要配置成true,以防地理格式错误导致文档被拒绝。
也可以在所以级别进行设置:
"settings": {
"index.mapping.ignore_malformed": true
}
备注2:需要先设置mapping,再导入数据mapping才会生效,如果先导入数据,再设置mapping,则第二天八点后才会生效(北京时间)。
三、kibana作图
1、在kibana中打开visualize->coordinate map
2、选择相应的索引进行画图
3、选择geoip.location作为聚合字段,然后设置Options,调整地图效果即可。
elasticsearch.yml 个人解读
Elasticsearch • 夏李俊 发表了文章 • 0 个评论 • 3707 次浏览 • 2018-02-09 16:08
- 属性 cluster.name 如果在同一网段下有多个集群,就可以用这个属性来区分不同的集群。
- 属性 node.name 节点名可以忽略
- 属性 node.master 指定该节点是否有资格被选举成为node,默认是true
- 属性 index.number_of_shard 设置默认索引分片个数,默认为5片
- 属性 index.number_of_replica 设置默认索引副本个数,默认为1个副本
- 属性 path.conf 设置配置文件的存储路径,默认是es根目录下的config文件夹。
- 属性 path.data 设置索引数据的存储路径,默认是es根目录下的data文件夹
- 属性 path.work 设置临时文件的存储路径,默认是es根目录下的work文件夹
- 属性 path.logs 设置日志文件的存储路径,默认是es根目录下的logs文件夹
- 属性 path.repo 快照存储路径
- 属性 gateway.recover_after_nodes 设置集群中N个节点启动时进行数据恢复,默认为1
- 属性 network.host 映射出来的ip
- 属性 transport.tcp.port 设置节点间交互的tcp端口,默认是9300
- 属性 http.port: 9200 设置对外服务的http端口,默认为9200
- 属性 index.number_of_replicas 索引的复制副本数量
- 属性 indices.fielddata.cache.size fielddata缓存限制,默认无限制
- 属性 indices.breaker.fielddata.limit fielddata级别限制,默认为堆的60%
- 属性 indices.breaker.request.limit request级别请求限制,默认为堆的40%
- 属性 indices.breaker.total.limit 保证上面两者组合起来的限制,默认堆的70%
- 属性 discovery.zen.ping.multicast.enabled 是否广播模式,默认true,广播模式即同一个网段的ES服务只要集群名[cluster.name]一致,则自动集群
- 属性 discovery.zen.ping.unicast.hosts 手动指定,哪个几个可以ping通的es服务做集群,注意该设置应该设置在master节点上,data节点无效
----------------------------------------------------------------------------------------------------------------------------------
GC Logging
monitor.jvm.gc.young.warn: 1000ms
monitor.jvm.gc.young.info: 700ms
monitor.jvm.gc.young.debug: 400ms
monitor.jvm.gc.old.warn: 10s
monitor.jvm.gc.old.info: 5s
monitor.jvm.gc.old.debug: 2s
Elasticsearch mapping 配置个人解读
Elasticsearch • 夏李俊 发表了文章 • 0 个评论 • 5921 次浏览 • 2018-02-09 15:47
配置详解
文件中"mapping":{}中的内容,即为创建索引的mappingsource 如:
"mappings": {
"_default_" : { //@1
"_all" : {"enabled" : true}, //@2
"properties" : { //@3
"tableType" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true}, //@4
"caption" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"code" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"description" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"perm" : {"type" : "string", "index" : "not_analyzed", "include_in_all" : false}
}
},
"ec02_goodsinfo" : { //@5
"_all" : {"enabled" : true}, //@6
"properties" : { //@7
"tableType" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"caption" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"code" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"description" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"perm" : {"type" : "string", "index" : "not_analyzed", "include_in_all" : false},
"bill":{ //@8
properties" : {
"CreateYear" : {"type" : "string", "index" : "not_analyzed", "include_in_all" : true} //@9
}
}
}
}
}
- @1 _default_所有单据默认的创建索引的配置
- @2 _all{} 每个单据下所有的字段配置,"enabled" : true 所有字段创建索引,false 所有字段禁止创建索引,[*注意]除非properties指定的字段,默认字段类型将自动匹配
- @3 properties {},每个单据下字段或者properties的指定配置
- @4 properties {}中指定了属性(properties):"tableType"的检索配置,type:string > 类型字符串,include_in_all:false > 改字段或者属性不包含在单据的所有字段中,"store": true > 储存在数据库中
- @5 ec02_goodsinfo 表示对单据 "ec02_goodsinfo" 的特定检索配置
- @6 _all{} 只对"ec02_goodsinfo"单据下所有的字段配置
- @7 properties {},只对"ec02_goodsinfo"单据下字段或者properties的指定配置
- [*注意]@8,@9 bill在单据中额字段都会包括一层bill,所以如果要对单据中某个字段指定需要套一层bill{}
-----------------------------------------------------------------------------------------------------------------------------------------
属性解说
版本5.X以前
- index 可选值为analyzed(默认)和not_analyzed,如果是字段是字符串类型的,则可以是not_analyzed
- store 可选值为yes或no,指定该字段的原始值是否被写入索引中,默认为no,即结果中不能返回该字段。
- boost默认为1,定义了文档中该字段的重要性,越高越重要
- null_value 如果一个字段为null值(空数组或者数组都是null值)的话不会被索引及搜索到,null_value参数可以显示替代null values为指定值,这样使得字段可以被搜索到。
- include_in_all 指定该字段是否应该包括在_all字段里头,默认情况下都会包含。
- type 可以指定String,long,int,doulbe,floot,boolean,等
版本5.X以后
- 原本type string,其index 可选值为analyzed(默认)和not_analyzed,现在直接拆违type text( index analyzed),type keyword(index not_analyzed)
- store 可选值为enable或false,指定该字段的原始值是否被写入索引中,默认为enable,即结果中不能返回该字段。
- index 表示是否用于检索默认enable,可选false
-------------------------------------------------------------------------------------------------------------------------------
字段的数据类型
- 简单类型string(指定分词器)
- date(默认使用UTC保持,也可以使用format指定格式)
- 数值类型(byte,short,integer,long,float,double)
- boolean
- binary(存储在索引中的二进制数据的base64表示,比如图像,只存储不索引)
- ip(以数字形式简化IPV4地址的使用,可以被索引、排序并使用IP值做范围查询)注意string是5.x以前的,5.x之后被分裂为text,keyword
有层级结构的类型,比如object 或者 nested.
特殊类型
- geo_point
- geo_shape
- completion
filebeat 收集不到日志
Beats • medcl 回复了问题 • 2 人关注 • 1 个回复 • 10135 次浏览 • 2018-02-10 12:30
kafka 添加kerberos认证
默认分类 • medcl 回复了问题 • 2 人关注 • 1 个回复 • 7127 次浏览 • 2018-02-10 12:27
logstash捕获日志,对日志的格式有怎样的要求
Logstash • luohuanfeng 回复了问题 • 3 人关注 • 2 个回复 • 3538 次浏览 • 2018-05-28 11:31
Elasticsearch安装X-pack,使用Java API创建client怎么设置ES的用户名密码?
Elasticsearch • zhu315555147 回复了问题 • 4 人关注 • 3 个回复 • 8971 次浏览 • 2018-03-24 12:23