zoukankan      html  css  js  c++  java
  • elasticksearch分词,导致kibana的url出现问题

    在Kibana的展示页面中,我们点击Table的左侧栏,发现Elasticsearch中的数据在展示中是正确的数据,比如:agent中www.baidu.com/test,该界面中会正确的显示为www.baidu.com/test,但是如果我们将该字段用Term展示出来的话,就会被分为www.baidu.com和test两组,通过查看CURL并没有发现其有任何问题,最后找到原因为Elasticsearch将其结果分开给了Kibana,所以Kibana会分开展示。
             通过研究,我们数据源为logstash自动收集过来的,索引是自动生成的,我们并不能去修改索引的Mapping将其设置为不分词,所以我们只能从其源头下手,当其创建的时候自动设置为不分词,这时我们就需要配置模板了。
    代码如下:
    curl -XPUT http://localhost:9200/_template/template_1 -d ' 
    {
      "template" :"logstash*",
      "order" : 0,
      "settings" : {
        "number_of_shards" : 5
      },
      "mappings" : {
        "fluentd" : {
          "properties":{
              "request_dir" :{"type":"string","index" :"not_analyzed"},
              "http_user_agent" : {"type" : "string","index" :"not_analyzed" }
          }
        }
      }
    }
    ‘
    其中重要的是mappings 中的设置,一级一级的按照数据源正则分解,"index" : "not_analyzed"为不分词,便于搜索
  • 相关阅读:
    python基本数据类型(—)
    linux基本命令
    1、认识Mysql
    Flask-SQLAlchemy详解
    sqlalchemy基本增删改查
    pymongo方法详解
    uWSGI+Nginx部署
    uwsgi
    nginx负载均衡配置
    redis-sentinel主从复制高可用(哨兵)
  • 原文地址:https://www.cnblogs.com/redheat/p/7069472.html
Copyright © 2011-2022 走看看