elasticSearch(一)--数据1

一、索引文档:

  Relational DB -> Databases -> Tables -> Rows -> Columns
  Elasticsearch -> Indices -> Types -> Documents -> Fields

  1、创建员工文档

   PUT /megacorp/employee/1

    { "first_name" : "John", "last_name" : "Smith", "age" : 25, "about" : "I love to go rock climbing", "interests": [ "sports", "music" ] }

  

 

  2、检索文档

  GET /megacorp/employee/1 

    我们通过HTTP方法 GET 来检索文档, 同样的, 我们可以使用 DELETE 方法删除文档, 使
  用 HEAD 方法检查某文档是否存在。 如果想更新已存在的文档, 我们只需再 PUT 一次。

  3、简单搜索

    GET /megacorp/employee/_search

  4、查询字符串搜索

    GET /megacorp/employee/_search?q=first_name:Jane

    搜索条件赋值给q

  5、DSL搜索

    GET /megacorp/employee/_search

    搜索条件:

    

 

  6、DSL+Filter搜索

    

 

 

 

 

 

 

 

  

posted on 2021-04-09 17:08  耗子0114  阅读(36)  评论(0编辑  收藏  举报

导航