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":{} 
    }
    }

  • 相关阅读:
    (转)了解JNDI
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver问题
    占个座
    关于 inode 与 iblock 的知识
    机器学习性能度量指标:ROC曲线、查准率、查全率、F1
    编译出现的问题解决
    二分查找(Binary Search)
    ST算法 Sliding Window algorithm template
    数据结构_算法
    知识点积累
  • 原文地址:https://www.cnblogs.com/ithubb/p/13237096.html
Copyright © 2011-2022 走看看