zoukankan      html  css  js  c++  java
  • 映射的介绍与使用

      主要讲mapping,定义结构。

    1.新增             

    PUT /nba/_mapping
    {
    	"properties": {
    		"name": {
    			"type": "text"
    		},
    		"team_name": {
    			"type": "text"
    		},
    		"position": {
    			"type": "keyword"
    		},
    		"play_year": {
    			"type": "keyword"
    		},
    		"jerse_no": {
    			"type": "keyword"
    		}
    	}
    }
    

      結果:

    {
      "acknowledged" : true
    }
    

      

    2.獲取

    GET /nba/_mapping
    

      结果:

    {
      "nba" : {
        "mappings" : {
          "properties" : {
            "jerse_no" : {
              "type" : "keyword"
            },
            "name" : {
              "type" : "text"
            },
            "play_year" : {
              "type" : "keyword"
            },
            "position" : {
              "type" : "keyword"
            },
            "team_name" : {
              "type" : "text"
            }
          }
        }
      }
    }
    

      

    3.批量获取

    GET /nba,cba/_mapping
    

      结果:

    {
      "nba" : {
        "mappings" : {
          "properties" : {
            "jerse_no" : {
              "type" : "keyword"
            },
            "name" : {
              "type" : "text"
            },
            "play_year" : {
              "type" : "keyword"
            },
            "position" : {
              "type" : "keyword"
            },
            "team_name" : {
              "type" : "text"
            }
          }
        }
      },
      "cba" : {
        "mappings" : { }
      }
    }
    

      

    4.获取所有

    GET /_mapping
    
    GET /_all/_mapping
    

      

    5.修改

      在下面添加一个新的字段。注意点,字段的类型不能修改。

    POST /nba/_mapping
    {
    	"properties": {
    		"name": {
    			"type": "text"
    		},
    		"team_name": {
    			"type": "text"
    		},
    		"position": {
    			"type": "keyword"
    		},
    		"play_year": {
    			"type": "keyword"
    		},
    		"jerse_no": {
    			"type": "keyword"
    		},
    		"contry":{
    		  "type": "keyword"
    		}
    	}
    }
    

      结果:

    {
      "acknowledged" : true
    }
    

      

  • 相关阅读:
    Cs231n课堂内容记录-Lecture1 导论
    Linux实时查询GPU使用命令
    导出excel的简单方法
    正则表达式的一些应用
    4、Python语法之变量
    javaScript中对typeof 和 instanceof 的使用及理解
    JavaScrpt 变量作用域
    真香的flex弹性布局
    css调试与样式优先级
    css3新样式
  • 原文地址:https://www.cnblogs.com/juncaoit/p/12595199.html
Copyright © 2011-2022 走看看