logstash7.4. mysql数据导入es并指定自定义的逗号分词器

    技术2022-07-10  137

    参考了: https://blog.csdn.net/alan_liuyue/article/details/78361431

                 https://www.cnblogs.com/jstarseven/p/7707499.html

    步骤一、 新建文件  template-es.json  (名字可自定义),内容如下:

    { "template": "*", "version": 50001, "settings": { "index.refresh_interval": "5s", "analysis": { "analyzer": { "comma": { "type": "pattern", "pattern":"," } } } }, "mappings": { "properties": { "id": { "type": "long" }, "template_name": { "type": "text", "analyzer": "standard" }, "template_data": { "type": "text", "analyzer": "standard" }, "author": { "type": "text", "analyzer": "standard" }, "keywords": { "type": "text", "analyzer": "comma" }, "category_ids": { "type": "text", "analyzer": "comma" }, "thumb_id": { "type": "long" }, "description": { "type": "text", "analyzer": "standard" }, "updated_at": { "type": "date" }, "created_at": { "type": "date" }, "@timestamp": { "type": "date" }, "@version": { "type": "keyword" } } } }

    步骤二、在logstash.conf配置如下:

    重启logstash, 亲测可用

    Processed: 0.034, SQL: 9