zoukankan      html  css  js  c++  java
  • Elasticsearch(索引操作

    查看集群状态

    GET _cluster/health
    http://192.168.1.200:9200/_cluster/health (GET)

    {
        "cluster_name": "cluster-es-node", #节点名称
        "status": "green", //状态 (三个状态 grenn 标识正长工作 yellow 表示有警告 为分配的 或其他 red 表示不用)
        "timed_out": false, #是否超时
        "number_of_nodes": 1, #
        "number_of_data_nodes": 1,
        "active_primary_shards": 0, #真时可用的分片
        "active_shards": 0, #激活的分片数
        "relocating_shards": 0,
        "initializing_shards": 0,
        "unassigned_shards": 0, #为分配的分片
        "delayed_unassigned_shards": 0,
        "number_of_pending_tasks": 0,
        "number_of_in_flight_fetch": 0,
        "task_max_waiting_in_queue_millis": 0,
        "active_shards_percent_as_number": 100.0
    }

    索引操作

    1.添加索引
    put 请求
    http://192.168.1.200:9200/index_temp
    index_temp(索引名称)
    josn参数
    {
    "settings":{
    "index":
    {
    "number_of_shards":"2", //主 分片数
    "number_of_replicas":"0" //备份分片数
    }
    }
    }

    返回信息
    {
        "acknowledged": true,
        "shards_acknowledged": true,
        "index": "index_temp"
    } 代表创建成功

    2.查询索引接口
    http://192.168.1.200:9200/index_temp (GET)

    返回
    {
        "index_temp": {
            "aliases": {}, (别名)
            "mappings": {}, (数据类型)
            "settings": {
                "index": {
                    "creation_date": "1586669227509", (创建时间
                    "number_of_shards": "2", (主分片)
                    "number_of_replicas": "0", (备份分片
                    "uuid": "oIz2uXxYTSKE4l7J4epsrA", (udid
                    "version": {
                        "created": "7060299" (版本
                    },
                    "provided_name": "index_temp" (索引名称)
                }
            }
        }
    }

    3.删除索引
    http://192.168.1.200:9200/index_temp (DELETE)请求

    再次查看被删除

    查询所有

  • 相关阅读:
    改写历史,永久删除git库的物理文件
    双调排序
    GitHub从无到有
    Nginx的安装与基本应用
    Django从无到有的艰苦历程
    pycharm 相关设置问题
    ORM介绍
    Django中的过滤器
    FBV和CBV的差异
    django中models field详解
  • 原文地址:https://www.cnblogs.com/loujiang/p/12684913.html
Copyright © 2011-2022 走看看