zoukankan      html  css  js  c++  java
  • es 使用模板创建索引

    创建模板:

    PUT _template/metric_datatest
    
    {
    	"index_patterns": ["metric_datatest-*"],
    	"order": 0,
    	"settings": {
    		"analysis": {
    			"analyzer": {
    				"tags_analyzer": {
    					"type": "pattern",
    					"pattern": ","
    				}
    			}
    		}
    	},
    	"mappings": {
    		"properties": {
    			"ts": {
    				"type": "long"
    			},
    			"name": {
    				"type": "keyword"
    			},
    			"tags": {
    				"type": "text",
    				"analyzer": "tags_analyzer"
    			},
    			"count": {
    				"type": "long"
    			},
    			"sum": {
    				"type": "double"
    			},
    			"max": {
    				"type": "double"
    			},
    			"min": {
    				"type": "double"
    			}
    		}
    	},
    	"aliases": {
    		"metric_datatest": {}
    	}
    }

    使用模板创建索引,不用指定mappings和settings:

    PUT /metric_datatest-2021-04-16

    插入需要指定具体的索引名,查询时只要使用别名metric_datatest就可以,可以并发查询别名对应的所有索引。

    不使用模板创建索引

    PUT /metric_data
    {
      "settings": {
        "analysis": {
          "analyzer": {
            "tags_analyzer": {
              "type": "pattern",
              "pattern": ","
            }
          }
        }
      },
      "mappings": {
        "properties": {
          "ts": {
            "type": "long"
          },
          "name": {
            "type": "keyword"
          },
          "tags": {
            "type": "text",
            "analyzer": "tags_analyzer"
          },
          "count": {
            "type": "long"
          },
          "sum": {
            "type": "double"
          },
          "max": {
            "type": "double"
          },
          "min": {
            "type": "double"
          }
        }
      }
    }
    

     

  • 相关阅读:
    idea 连接 hive
    css img自适应
    测试视频文件
    ubuntu不显示ipv4地址的解决办法
    nginx path捕获
    union all两个结果集报ORA-12704: character set mismatch错误
    润乾报表试用指南
    报表工具对比之润乾报表与锐浪报表对比
    项目微管理36
    docker远程调用
  • 原文地址:https://www.cnblogs.com/yaoyu1983/p/14667911.html
Copyright © 2011-2022 走看看