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

    集群的运行状况

    GET /_cat/health?v

    获取集群中的节点列表

    GET /_cat/nodes?v

    列出所有索引

    GET /_cat/indices?v

    创建索引 指定参数

    PUT twitter
    {
        "settings" : {
            "index" : {
                "number_of_shards" : 3, 
                "number_of_replicas" : 2 
            }
        }
    }
    PUT test
    {
        "settings" : {
            "number_of_shards" : 1
        },
        "mappings" : {
            "_doc" : {
                "properties" : {
                    "field1" : { "type" : "text" }
                }
            }
        }
    }
    删除索引
    DELETE /goods


    创建文档

    put /customer/_doc/1?pretty
    {
    "name":"hahh",
    "age":10

    }

    POST /customer/_doc
    {
    "list":"uyuu",
    "age":23
    }

    查询文档

    GET /customer/_doc/1?pretty

    修改文档

    PUT /customer/_doc/1
    {
    "age":56
    }

    POST /customer/_doc/1/_update
    {
    "doc":{
    "name":"name"
    }
    }

    删除文档

    DELETE /customer/_doc/1?pretty

    批量添加

    POST /customer/_doc/_bulk
    {"index":{"_id":3}}
    {"name":"lilin"}
    {"index":{"_id":4}}
    {"name":"limen"}

    批量修改和删除

    POST /customer/_doc/_bulk
    {"update":{"_id":3}}
    {"doc":{"name":"lilin123"}}
    {"delete":{"_id":4}}

    批量获取多条数据

    GET /customer/_doc/_mget
    {
    "ids":[1,2,3]
    }

    搜索

    POST /customer/_doc/_bulk
    {"index":{"_id":1}}
    {"name":"lilan","age":10,"sex":1}
    {"index":{"_id":2}}
    {"name":"huandan","age":11,"sex":2}
    {"index":{"_id":3}}
    {"name":"miaomiao","age":12,"sex":1}

    搜索所有

    GET /customer/_doc/_search

    通过名字带 miaomiao 的

    get  /customer/_doc/_search?q=name:miaomiao

    查询所有

    GET /customer/_doc/_search
    {
    "query":{
    "match_all":{} 
    }
    }

  • 相关阅读:
    Jmeter命令行运行实例讲解
    ab压力测试工具
    F12找到页面某一元素所绑定的点击事件
    F12修改html进行本地js操作页面元素
    JMeter中利用Parameters 和Body Data传递参数有什么不同
    centos7 VNC安装
    centos7安装python3
    linux du命令的疑惑
    centos cgroup配置
    linux下postgres未能正常启动的解决过程
  • 原文地址:https://www.cnblogs.com/ithubb/p/13237096.html
Copyright © 2011-2022 走看看