zoukankan      html  css  js  c++  java
  • 【十次方基础教程(后台)】安装ElasticSearch并使用

    安装

    解压相关的压缩包,定位到bin文件夹下

    命令:elasticsearch

    jdk必须是1.8以上的

    然后等9300,9200两个端口都启动成功

    java开发使用9300,其他开发使用9200

    创建索引库

    在postman输入地址(提交方式是PUT

    http://localhost:9200/索引库名

    如http://localhost:9200/tensquare_elasticsearch,创建名为tensquare_elasticsearch的索引库

    简单的操作

    新建文档

    直接在地址后面跟文档名,然后通过JSON传数据,ID自动生成,提交方式为POST

    http://localhost:9200/索引库名/文档名

    如http://localhost:9200/tensquare_elasticsearch/article,在tensquare_elasticsearch索引库创建一个名为article的文档

    参数为Json,如

    {
    "title":"spring教程",
    "content":"spring框架教程"
    }

    查询所有(提交方式为GET

    http://localhost:9200/索引库名/文档名/_search

    修改(提交方式为PUT

    http://localhost:9200/索引库名/文档名/id

    (若ID不存则重新创建一条)

    参数为Json,如

    {
    "title":"spring教程",
    "content":"spring框架教程"
    }

    根据ID查询(提交方式为GET

    http://localhost:9200/索引库名/文档名/id

    按条件查询(会模糊查询(对词条,不对单字,会分词),提交方式为GET

    http://localhost:9200/索引库名/文档名/_search?q=字段名:数值

    如http://localhost:9200/tensquare_elasticsearch/article/_search?q=content:教程,查询content字段里面有“教程”两个字的

    模糊查询(正常的整体模糊匹配,提交方式为GET

    http://localhost:9200/索引库名/文档名/_search?q=字段名:*数值*

  • 相关阅读:
    Can you feel my word?
    木语录
    走在风雨中
    我看平淡生活……
    Can you feel my word?
    我看平淡生活……
    留言本
    Python(七)之匿名函数lambda
    python之常用模块logging
    python(六)之面向对象
  • 原文地址:https://www.cnblogs.com/IceBlueBrother/p/10855239.html
Copyright © 2011-2022 走看看