ElasticSearch 7 索引的使用

通过postman 创建索引

  • 新增
  请求(PUT)
  {{ElasticSearchUrl}}/nba
  响应
  {
    "acknowledged": true,
    "shards_acknowledged": true,
    "index": "nba"
}
  • 获取索引
  请求(GET)
  {{url}}/nba
  响应
  {
    "nba": {
        "aliases": {},         					 	(别名)
        "mappings": {}, 							(映射)
        "settings": {     							(索引设置)
            "index": {
                "creation_date": "1595246790582", 	(创建时间)
                "number_of_shards": "1",			(分片数量)
                "number_of_replicas": "1",			(副本数量)
                "uuid": "RyZZuqQ0QlGBDkJuEto0_w",	(唯一标示)
                "version": {
                    "created": "7040299"
                },
                "provided_name": "nba"
            }
        }
    }
}
  • 删除索引
  请求(delete)
  {{url}}/nba
  响应
  {
    "acknowledged": true
  }
  • 批量获取索引
 请求(GET)
 获取多个
 {{url}}/nba,article
 获取全部 
 {{url}}/_all
 响应
 {
    "article": {
        "aliases": {},
        "mappings": {},
        "settings": {
            "index": {
                "creation_date": "1595247826341",
                "number_of_shards": "1",
                "number_of_replicas": "1",
                "uuid": "BtJn0o3URrqEdZfNmfoAhg",
                "version": {
                    "created": "7040299"
                },
                "provided_name": "article"
            }
        }
    },
    "nba": {
        "aliases": {},
        "mappings": {},
        "settings": {
            "index": {
                "creation_date": "1595247819911",
                "number_of_shards": "1",
                "number_of_replicas": "1",
                "uuid": "9QVAl4c-RWyZub6QtWdc0Q",
                "version": {
                    "created": "7040299"
                },
                "provided_name": "nba"
            }
        }
    }
}
  • 获取全部索引 - cat
请求(GET)
{{url}}/_cat/indices?v
响应
health status index   uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   hello   DUtplWjcQsyGttCHmRF3zQ   1   1          1            0      4.7kb          4.7kb
yellow open   nba     9QVAl4c-RWyZub6QtWdc0Q   1   1          0            0       283b           283b
yellow open   article BtJn0o3URrqEdZfNmfoAhg   1   1          0            0       283b           283b

  • 判断索引是否存在
 请求(HEAD)
 {{url}}/nba
 响应
 返回 200
  • 关闭索引
 请求(POST)
 {{url}}/nba/_close
 响应
 {
    "acknowledged": true,
    "shards_acknowledged": true,
    "indices": {
        "nba": {
            "closed": true
        }
    }
}

你可能感兴趣的:(ElasticSearch,elasticsearch)