zoukankan      html  css  js  c++  java
  • Elastic Search 学习之路(三)—— tutorial demo

    一、ElasticSearch tutorial demo

    example 1. 单机、local、CRUD操作

    实现方式:

    SpringBoot + ElasticSearch

    拷贝的小demo,原文地址:https://www.journaldev.com/18148/spring-boot-elasticsearch

    实现的功能:

    通过 RestHighLevelClient 对 ElasticSearch 中的document,进行CRUD操作。原文中没实现依据index获取所有document功能,我已经添加好了。还添加了全文检索的功能,以及一些注释。

    tutorial demo放在了我个人的github地址中:

    https://github.com/lihao5257/elasticSearch-demo.git

     验证效果时,需要的memo:

    1.确认ES启动:127.0.0.1:9200
    2.下面是新加document或是修改是用到的Json:
    [
        {
            "author""JournalDev",
            "price"199.1,
            "id""87a3a002-c68a-488b-8172-2510c4be9d41",
            "title""Java Always"
        },
        {
            "author""JournalDev",
            "price"299.1,
            "id""7172b649-4846-47ad-a9d9-6e5b93302c46",
            "title""Lee"
        },
        {
            "author""JournalDev",
            "price"799.1,
            "id""96fe24ee-49fe-48a8-a7df-65866cbda618",
            "title""Song"
        },
        {
            "author""Tom",
            "price"223.4,
            "title""JiM Green"
        },
        {
            "author""Sony Green",
            "price"19.8,
            "title""Harry Poart"
        },
        {
            "author""Sony Green",
            "price"19.8,
            "title""Harry Poart 2"
        },
        {
            "author""Sony Green",
            "price"19.8,
            "title""Harry Poart 3"
        }
    ]

    3.获取所有documents:127.0.0.1:8080/books/allBooks
    4.根据ID查询document:127.0.0.1:8080/books/id

     推荐一个叫做Postman的工具,使用curl很方面。

    二、跟文档学习

    地址:https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.6/java-rest-high.html

    参考的文档版本为7.6,选的目前release的最新版本。

     里面的文档非常的全面,doucument api,search api,里面关于单次,多次查询,bulk操作,同步异步发送请求,讲解的非常清晰明白,我在这里就不再重新说明了。有不懂的地方,欢迎交流。我看了3个多小时,将客户端3节的api文档看完了,有些东西都是相通的,越看越会发现共同之处。

  • 相关阅读:
    WebFrom 小程序【分页功能 】
    WebForm 【Repeater】展示数据
    WebForm 小项目【人员管理系统】分析
    WebFrom 【内置对象】— —跳转页面,页面传值
    WebForm 【复合控件】
    WebForm 【简单控件】【表单元素】
    WebForm 基础学习
    js对元素属性.内容的操作。定时器。元素的平级,父级,子集关系。
    常用事件【由浅入深】1
    document 对象
  • 原文地址:https://www.cnblogs.com/lihao007/p/12552922.html
Copyright © 2011-2022 走看看