• 映射的介绍与使用


      主要讲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
    }
    

      

  • 相关阅读:
    深入理解JavaScript闭包
    冒泡排序
    Objective-C中的self和super
    IOS中UIKit——UIButton的背景图像无法正常显示的原因
    IOS绘图——简单三角形
    NSDateFormatter中时间格式串的含义
    IOS屏幕布局
    IOS学习感想
    WWDC————苹果全球开发者大会
    刚开始学IOS遇到的类和方法
  • 原文地址:https://www.cnblogs.com/juncaoit/p/12595199.html
Copyright © 2020-2023  润新知