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=字段名:*数值*

  • 相关阅读:
    Pedometer_forAndroid
    linux改动登陆主机提示信息
    Cocos2d-x-Lua (2.x)脚本开发之 Lua语言基础
    共享库加载时重定位
    寻找志同道合的伙伴
    Leetcode[20]-Valid Parentheses
    storm的集群安装与配置
    CSS样式
    splash启动速度优化
    Android驱动之 Linux Input子系统之TP——A/B(Slot)协议
  • 原文地址:https://www.cnblogs.com/IceBlueBrother/p/10855239.html
Copyright © 2011-2022 走看看