zoukankan      html  css  js  c++  java
  • 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
      }
    }'
  • 相关阅读:
    Ural_1018. Binary Apple Tree(树形DP)
    2011 Asia Shanghai Regional Contest Problem A
    Ural_1012. Kbased Numbers. Version 2(dp)
    HDU_1524 A Chess Game (sg函数)
    HDU_1760 A New Tetris Game(dfs + 博弈)
    POJ_2023 Choose Your Own Adventure(DFS)
    POJ_3267 The Cow Lexicon(DP)
    Qt 的QString类的使用
    用QFileSystemModel和Listview做的简易图片浏览
    Qt 对文件的操作
  • 原文地址:https://www.cnblogs.com/kwzblog/p/11646891.html
Copyright © 2011-2022 走看看