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
    }
    

      

  • 相关阅读:
    【NOIP2006T】作业调度方案
    「NOIP2012P」寻宝
    51Nod1084 矩阵取数问题 V2
    51Nod1294 修改数组
    51nod1122 机器人走方格V4
    多项式相关模板#1
    51Nod1514 美妙的序列
    Jzoj5674 香槟
    Jzoj5669 排列
    Jzoj5665 奥立卡的诗
  • 原文地址:https://www.cnblogs.com/juncaoit/p/12595199.html
Copyright © 2011-2022 走看看