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
    }
    

      

  • 相关阅读:
    爬虫requests模块 1
    刷题记录:ctf473831530_2018_web_virink_web
    刷题记录:[RCTF 2019]Nextphp
    CTF XSS
    PHP 7 源码学习 序&第一、二章
    刷题记录:[安洵杯 2019]iamthinking
    刷题记录:[GWCTF 2019]枯燥的抽奖
    preg_match绕过总结
    刷题记录:[SWPU2019]easy_python
    刷题记录:[GWCTF 2019]我有一个数据库
  • 原文地址:https://www.cnblogs.com/juncaoit/p/12595199.html
Copyright © 2011-2022 走看看