Elasticsearch在windows上安装与使用
Elasticsearch简称ES。
是一个全文搜索服务器,也可作为NoSQL数据库,存储任意格式的文档和数据,也可做大数据的分析,是一个跨界开源产品。
ES的特点:
全文搜索引擎
文档存储和查询
大数据分析
提供了REST API,用来简化对ES的操作
常常配合传统数据库一起使用,ES用来负责大数据的查询、搜索、统计分析
1.下载
elasticsearch-6.8.3.zip https://www.elastic.co/downloads/past-releases#elasticsearch
2.启动
解压 elasticsearch-6.8.3.zip
打开cmd,进入elasticsearch的bin
elasticsearch
9200端口是对外的RESTFul接口,9300端口是ES内部使用的端口
启动后在浏览器 http://localhost:9200/

说明:
name代表这台ES的名字
cluster_name默认名字是elasticsearch。ES的集群方式是通过广播在同一个网络中寻找cluster_name一样的ES
如果想修改配置,可以在config/elasticsearch.yml配置
3.基本概念
Index:是Document的集合,Index包含了Type,相当于数据库
Type:用来进一步组织Document,一个Index可以有多个Type,相当于表
Document:文档,是ES能够存储和搜索的基本信息,Document属于Type,相当于行数据,json格式的
Node:节点,是集群里的一台ES Server,用于Document的存储和查询
Shards:分区,Index超过了单个节点存储的限制,就会将Index进行分区
Replicas:复制分区,将Index分为多个分区,Index的分区为主分区,复制的分区为复制分区
4.基本使用
(1)添加文档
curl -XPOST 'localhost:9200/store/category/1?pretty' -H 'Content-type:application/json' -d'{"name":"soap","type":"cleaning","postDate":"2019-9-15","message":"this is a first data"}'

(2)根据主键查询
curl -XGET 'localhost:9200/store/category/1?pretty'

(3)根据主键更新
curl -XPUT 'localhost:9200/store/category/1?pretty' -H 'Content-type:application/json' -d'{"name":"soap123","type":"cleaning","postDate":"2019-9-15T23:10:10","message":"update data"}'

只更新message
curl -XPOST 'localhost:9200/store/category/1?pretty' -H 'Content-type:applicat ion/json' -d'{"doc":{"message":"only update message"}}'

(4)根据主键删除
curl -XDELETE 'localhost:9200/store/category/1?pretty'

(5)搜索
curl -XPOST 'localhost:9200/store/category/_search?pretty'

全文搜索
curl -XPOST 'localhost:9200/store/category/_search?pretty' -H 'Content-type:application/json' -d'{"query":{"match":{"message":"data"}}}'

精确搜索
curl -XPOST 'localhost:9200/store/category/_search?pretty' -H 'Content-type:application/json' -d'{"query":{"term":{"type":"cleaning"}}}'

查询总数
将_count替换_search
curl -XPOST 'localhost:9200/store/category/_count?pretty' -H 'Content-type:application/json' -d'{"query":{"match":{"message":"data"}}}'

联合查询
curl -XPOST 'localhost:9200/store/category/_search?pretty' -H 'Content-type:application/json' -d'{"query":{"bool":{"must":[{"term":{"type":"eating"}},{"match":{"message":"second"}}]}}}'

翻页,使用from和size
curl -XPOST 'localhost:9200/store/category/_search?pretty' -H 'Content-type:application/json' -d'{"from":1,"size":1,"query":{"match":{"message":"data"}}}'

说明:
安装了git就会带有curl功能了
Elasticsearch在windows上安装与使用的更多相关文章
- Elasticsearch在windows上安装好了之后怎么使用?
windows 10上安装Elasticsearch过程记录 一.安装和配置Java JDK1.下载:http://download.oracle.com/otn ... 4.exe2.设置环境变量: ...
- 在Windows上安装Elasticsearch 5.0
在windows上安装Elasticsearch Elasticsearch可以使用.zip软件包安装在Windows上. elasticsearch-service.bat命令,它将设置Elasti ...
- 在Windows上安装Elasticsearch 5.x
在Windows上安装Elasticsearch 5.x 自己想学习Elasticsearch,但是又不懂Linux,按照同事给的Linux安装教程,也是搞不明白,于是想先在Windows上安装一下入 ...
- ElasticSearch | windows 上安装ES
Elastatic需要java JAVA8 环境,确保安装好环境 在windows上安装ES还是比较简单的, 1.首先在官网上下载zip,地址 https://www.elastic.co/downl ...
- Windows上安装ElasticSearch7的IK分词器
首先IK分词器和ES版本一定要严格对应,下面是版本对照表 IK分词器下载地址 https://github.com/medcl/elasticsearch-analysis-ik/releases 我 ...
- Windows上安装ElasticSearch7
安装JDK1.8(包括)以上版本 安装ElasticSearch ElasticSearch下载地址: https://www.elastic.co/downloads/elasticsearch 双 ...
- 在windows上安装elasticsearch7.6
在windows上安装elasticsearch7.6 安装Java1.8 下载Java1.8 提取码:yi0c 链接:https://pan.baidu.com/s/1mNd2Yg-k6ob91bO ...
- 在 Windows 上安装Rabbit MQ 指南
rabbitMQ是一个在AMQP协议标准基础上完整的,可服用的企业消息系统.他遵循Mozilla Public License开源协议.采用 Erlang 实现的工业级的消息队列(MQ)服务器. Ra ...
- 在Windows上安装虚拟机详细图文教程
用虚拟机来安装最新的软件,安装最新的系统等等比较保险,可以避免安装不顺利影响自己原来的系统和应用,想尝鲜又担心自己完全更换系统不适应的朋友可以尝试. 虚拟机下载:https://yunpan.cn/c ...
随机推荐
- python基础语法2 流程控制 if,while,for
if语句: 什么是if? 主要是用于判断事物得对错,真假,是否可行 语法结构: python是通过缩进来决定代码的归属 pep8: 缩进一定是四个空格 tab键 if 条件: 代码块 .... ... ...
- AppDomain.Unload_MarshalByRefObject
internal string GetClassInfo(string assemblyName, string className, string strField) { string ret = ...
- MySQL中Count函数的参数该传入什么样的值?
MySQL中Count函数的参数该传入什么样的值? 查询用户表中总记录 用户表中信息如下: 1.SELECT COUNT(*) FROM USER 结果为:3条 2. SELECT COUNT(us ...
- ios app ipv6 审核总结
AAAA记录(AAAA record)是用来将域名解析到IPv6地址的DNS记录.用户可以将一个域名解析到IPv6地址上,也可以将子域名解析到IPv6地址上. 1)$ dig +nocmd +nost ...
- SSFOJ P1453 子序列(一) 题解
每日一题 day61 打卡 Analysis las数组表示的是最近一个为j的位置为是什么. dp数组的含义是以str[i]为结尾的子序列数量. 于是有状态转移方程: dp[las[i][j]]+=d ...
- linux服务器升级python版本(python2与python3共存)
linux服务器升级python版本 ######################################## 第一步先安装sqlite-devel,因为python2也有这个,python3 ...
- MyBatis试题
在使用MyBatis的时候,除了可以使用@Param注解来实现多参数入参,还可以用()传递多个参数值. (选择一项) A.用Map对象可以实现传递多参数值 B.用List对象可以实现传递多参数值 C. ...
- vue 百度地图多标注展示和点击标注进行的提示
index.html中加入script <script type="text/javascript" src="http://api.map.baidu.com/a ...
- MSSQL随机修改时间
GO DECLARE @BDate datetime, @EDate datetime SET @BDate = '20190801' --上限 SET @EDate = '20190819 23:5 ...
- python 路径拼接
>>> import os>>> os.path.join('/hello/','good/boy/','doiido')>>>'/hello/g ...