• elasticsearch中的mapping模式 有三种可以设置


    # elasticsearch中的三种模式

    # 第一种动态模式 默认就是dynamic模式
    PUT mapping
    {
      "mappings": {
        "properties": {
          "name":{
            "type": "keyword"
          },
          "age":{
            "type": "long"
          }
        }
      }
    }
    
    PUT mapping/_doc/1
    {
      "name":"蔡恒",
      "age":28
    }
    GET mapping
    
    
    PUT mapping/_doc/2
    {
      "name":"你好",
      "age":24,
      "company":"武汉"
    }
    # 第二种静态模式
    PUT mapping2
    {
      "mappings": {
        "dynamic":false,
        "properties": {
          "name":{
            "type": "text"
          },
          "age":{
            "type": "long"
          }
        }
      }
    }
    
    
    GET mapping2
    
    PUT mapping2/_doc/1
    {
      "name":"caiheng",
      "age":28,
      "company":"wuhan"
    }
    
    GET mapping2/_search
    
    
    # 第三种严格模式
    
    PUT mapping3
    {
      "mappings": {
        "dynamic":"strict",
        "properties": {
          "name":{
            "type": "text"
          },
          "age":{
            "type": "long"
          }
        }
      }
    }
    
    PUT mapping3/_doc/1
    {
      "name":"hahah",
      "age":25,
      "company":"五哈"
    }
    
    GET mapping3
  • 相关阅读:
    合一算法最新版
    string.at(i)
    字符串逆转
    String
    Vector
    1005POJ
    但愿天堂一切都好
    合一算法
    合一算法2
    BTREE与其它索引的优缺点对比
  • 原文地址:https://www.cnblogs.com/ch2020/p/15643423.html
Copyright © 2020-2023  润新知