asu126 / learn

我的知识文库
1 stars 0 forks source link

es 文档整理 #86

Open asu126 opened 6 years ago

asu126 commented 6 years ago
asu126 commented 6 years ago

模板索引 logstash 文档:https://doc.yonyoucloud.com/doc/logstash-best-practice-cn/output/elasticsearch.html http://blog.csdn.net/yesicatt/article/details/53393814 更新错误: https://discuss.elastic.co/t/update-mapping-of-not-analyzed-field/59173/2 http://www.cnblogs.com/Creator/p/3722408.html

       "project_name": {
          "type": "string",
          "index": "not_analyzed",
          "fields": {
            "raw": {
              "type": "string",
              "index": "not_analyzed"
            },
            "search": {
              "type": "string"
            }
          }
        }
asu126 commented 6 years ago

get mapping: http://127.0.0.1:9200/test-env-gitlab-shell-2018.01.21/_mapping/gitlab-shell-log/field/project_name?include_defaults=true

asu126 commented 6 years ago
{
    "size": 0,
    "query": {
        "bool": {
            "filter": {
                "range": {
                    "@timestamp": {
                        "gte": "2018-02-25",
                        "lte": "2018-02-25"
                    }
                }
            },
            "must": {
                "exists": {
                    "field": "project_name"
                }
            }
        }
    },
    "aggs": {
        "group_by_ip_and_project":{
            "terms":{
                "field":"remote_addr",
                "size" : 0
            },
            "aggs":{
                "project_name": { 
                    "terms": { 
                        "field": "project_name",
                        "size" : 0
                    },
                    "aggs":{
                        "p_body_bytes_sent":{
                            "sum":{
                                "field":"body_bytes_sent"
                            }
                        }
                    }
                }
            }
        }
    }
}
asu126 commented 5 years ago
asu126 commented 5 years ago

准备备份

curl -X PUT "http://localhost:9200/_snapshot/asu_backup/snapshot_2?pretty=true" -H 'Content-Type: application/json' -d' { "indices": "twitter" } '

/tmp 目录无权限写错误恢复

-Djava.io.tmpdir=/var/lib/elasticsearch/tmp
-Djna.tmpdir=/var/lib/elasticsearch/tmp

参考

升级

https://dongbo0737.github.io/2017/06/06/elasticsearch-2.4-5.2/

源码分析

https://www.felayman.com/category/Elasticsearch+6.0+%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90/1 https://www.cnblogs.com/zziawanblog/category/977414.html https://juejin.im/post/5a2b653f5188251c11408b22