• elasticSearch基本使用


    1.elasticSearch命令的基本格式

    RESTful接口URL的格式:

    http://localhost:9200/<index>/<type>/[<id>]

    其中index、type是必须提供的。id是可选的,不提供es会自动生成。index、type将信息进行分层,利于管理。index可以理解为数据库;type理解为数据表;id相当于数据库表中记录的主键,是唯一的。

    :在url网址后面加"?pretty",会让返回结果以工整的方式展示出来,适用所有操作数据类的url。"?"表示引出条件,"pretty"是条件内容。

    2.elasticSearch基本的增删改

    1.1 增

    curl -H "Content-Type: application/json" -XPUT 'http://192.168.2.232:9200/store/books/1?pretty' -d '{
    "title": "Elasticsearch: The Definitive Guide",
    "name" : {
    "first" : "Zachary",
    "last" : "Tong"
    },
    "publish_date":"2015-02-06",
    "price":"49.99"
    }'

    1.2 删

     curl -XDELETE 'http://192.168.2.232:9200/store/books/1?pretty'

    1.3 更新

    (1)可通过覆盖更新

    curl -"Content-Type:application/json" -XPUT 'http://192.168.2.232:9200/store/books/1?pretty' -d '{

      "title""Elasticsearch: The Definitive Guide",
      "name" : {
        "first" "Zachary",
        "last" "Tong"
      },
      "publish_date":"2016-02-06",
      "price":"99.99"
    }'
    (2) 通过_update API的方式单独更新你想要更新的
    curl -"Content-Type: application/json" -XPOST 'http://192.168.2.232:9200/store/books/1/_update?pretty' -d '{
      "doc": {
         "price" 88.88
      }
    }'
  • 相关阅读:
    python 检测mobileprovision证书的过期时间
    dynamodb 分区键排序键介绍
    dynamodb 基本操作
    Python 实现一个栈
    openstack阅读链接
    mongoengine文档
    机器学习链接
    mongoengine的使用
    Timer(让函数定时执行)
    线程,进程,IO多路复用,协程的代码
  • 原文地址:https://www.cnblogs.com/kwzblog/p/11646891.html
Copyright © 2020-2023  润新知