logstash7.4. mysql數據導入es並指定自定義的逗號分詞器

參考了: 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, 親測可用

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章