沙师弟,师父的充电器掉了

pipeline不能convert成text date类型

Beats | 作者 bzg119 | 发布于2019年09月02日 | 阅读数:1980

想把message里的内容,拆成time, content
原来的message不再分词,转换成keyword
content转换成text
time转换成date
 
但是发现es6.1.4 beats6.1.4的pipeline不能转换成date  text
 
如下:
 
PUT _ingest/pipeline/test_parttern_01{
    "description" : "test pipeline",
    "processors": [
        {
            "grok": {
                "field": "message",
                "patterns": [
                    "%{TIMESTAMP_ISO8601:time}\\s*\\|\\s*%{DATA:level}\\s*\\|\\s*%{str:content}"
                ],
                "pattern_definitions": {
                     "str": "[\\s\\S]*"
                }
            }
        },
        {
            "convert": {
               "field": "content",
               "type": "text"
            }
        },
        {
            "convert": {
               "field": "time",
               "type": "date"
            }
        }
    ]
}
 
分别报错:
"reason": "[type] type [text] not supported, cannot convert field.",

"reason": "[type] type [date] not supported, cannot convert field.",
 
请大神指导应该怎么处理?
如何把原来的:message不作分词,拆分的fields再去转换成date , text
 
 
 
已邀请:

bellengao - 博客: https://www.jianshu.com/u/e0088e3e2127

赞同来自: bzg119

Convert Processor: The supported types include: integer, long, float, double, string, boolean, and auto. content默认应该就是text,不用使用convert进行转换;time的话可以使用 Date Processor(https://www.elastic.co/guide/e ... .html),例如:
{
    "date": {
      "field": "time",
      "formats": ["ISO8601"],
      "timezone": "Asia/Shanghai",
      "ignore_failure": true
    },
    "remove": {
      "field": "time"
    }
  }

bzg119

赞同来自:

或者换种方式问下:
pipeline提取的字段,在fields.yml怎么定义?
提取的字段,想转换成text可以分词

bzg119

赞同来自:

@bellengao - 博客: https://www.jianshu.com/u/e0088e3e2127
 谢谢答复。
我用的是filebeat6.1.4
fields.yml里增加了配置:定义了一个content
    - name: message
      type: text
      ignore_above: 0
      required: true
      description: >
        The content of the line read from the log file.

    - name: content
      type: text
      ignore_above: 0
      required: true
      description: >
        The content of the line read from the log file.
 
然后,filebeat创建索引后,去查询索引,发现content还是keyword
"content": {
    "type": "keyword",
    "ignore_above": 1024
}
 
那个dynamic_templates我没有配置,不知道在filebeat.yml还是fields.yml里配置。我看内容,应该是默认将string当成keyword的默认配置,我不用配置吧。。
 

bzg119

赞同来自:

或者说:fiels.yml里增加content定义为text不生效。
filebeat可以直接修改dynamic_templates的定义吗?
 

要回复问题请先登录注册