elasticsearch

消费elasticsearch的数据。

Example

常规

  1. pipelines:
  2. - name: local
  3. sources:
  4. - type: elasticsearch
  5. name: elastic
  6. hosts: ["localhost:9200"]
  7. indices: ["blog*"]
  8. size: 10 # data size per fetch
  9. interval: 30s # pull data frequency

高级

  1. pipelines:
  2. - name: local
  3. sources:
  4. - type: elasticsearch
  5. name: elastic
  6. hosts:
  7. - "localhost:9200"
  8. - "localhost:9201"
  9. indices: ["blog*"]
  10. username: "bob"
  11. password: "bob"
  12. schema: ""
  13. sniff: false
  14. gzip: true
  15. includeFields: # pull selected field
  16. - Title
  17. - Content
  18. - Author
  19. excludeFields: # exclude selected field
  20. - Content
  21. query: | # elastic query phrases
  22. {
  23. "match": {"Title": "bob"}
  24. }
  25. size: 10 # data size per fetch
  26. interval: 30s # pull data frequency
  27. timeout: 5s # pull timeout
  28. db:
  29. flushTimeout: 2s # persistent the elastic pull location frequency
  30. cleanInactiveTimeout: 24h # delete the db record after the time
  31. cleanScanInterval: 1h # check the expired db record frequency

hosts

字段类型是否必填默认值含义
hostsstring数组必填消费的elasticsearch url地址

indices

字段类型是否必填默认值含义
indexstring数组必填查询elasticsearch的index名称

username

字段类型是否必填默认值含义
usernamestring非必填消费elasticsearch的用户名

password

字段类型是否必填默认值含义
passwordstring必填消费elasticsearch的密码

schema

字段类型是否必填默认值含义
schemastring非必填httpHTTP scheme(http/https),sniff的时候使用

gzip

字段类型是否必填默认值含义
gzipbool非必填false是否开启gzip压缩

includeFields

字段类型是否必填默认值含义
includeFieldsstring数组非必填只返回指定的_source字段

excludeFields

字段类型是否必填默认值含义
excludeFieldsstring数组非必填排除指定的_source字段

query

字段类型是否必填默认值含义
querystring非必填查询elasticsearch的表达式

size

字段类型是否必填默认值含义
sizeint非必填100每次请求得到hits返回的个数

interval

字段类型是否必填默认值含义
intervaltime.Duration非必填30s定时请求elasticsearch的时间间隔

timeout

字段类型是否必填默认值含义
timeouttime.Duration非必填5s请求的超时时间

db

字段类型是否必填默认值含义
db非必填持久化记录查询elasticsearch请求的进度,会存储至elasticsearch中,避免Loggie重启后重复消费数据
db.indexPrefixstring非必填.loggie-db默认情况下,loggie会将持久化的数据定时写入格式为${indexPrefix}-${pipelineName}-${sourceName}的index中
db.flushTimeouttime.Duration非必填2s持久化数据写入的间隔时间
db.cleanInactiveTimeouttime.Duration非必填504h (21day)清理过期的持久化数据超时时间
db.cleanScanIntervaltime.Duration非必填1h检查过期时间间隔