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上安装与使用的更多相关文章

  1. Elasticsearch在windows上安装好了之后怎么使用?

    windows 10上安装Elasticsearch过程记录 一.安装和配置Java JDK1.下载:http://download.oracle.com/otn ... 4.exe2.设置环境变量: ...

  2. 在Windows上安装Elasticsearch 5.0

    在windows上安装Elasticsearch Elasticsearch可以使用.zip软件包安装在Windows上. elasticsearch-service.bat命令,它将设置Elasti ...

  3. 在Windows上安装Elasticsearch 5.x

    在Windows上安装Elasticsearch 5.x 自己想学习Elasticsearch,但是又不懂Linux,按照同事给的Linux安装教程,也是搞不明白,于是想先在Windows上安装一下入 ...

  4. ElasticSearch | windows 上安装ES

    Elastatic需要java JAVA8 环境,确保安装好环境 在windows上安装ES还是比较简单的, 1.首先在官网上下载zip,地址 https://www.elastic.co/downl ...

  5. Windows上安装ElasticSearch7的IK分词器

    首先IK分词器和ES版本一定要严格对应,下面是版本对照表 IK分词器下载地址 https://github.com/medcl/elasticsearch-analysis-ik/releases 我 ...

  6. Windows上安装ElasticSearch7

    安装JDK1.8(包括)以上版本 安装ElasticSearch ElasticSearch下载地址: https://www.elastic.co/downloads/elasticsearch 双 ...

  7. 在windows上安装elasticsearch7.6

    在windows上安装elasticsearch7.6 安装Java1.8 下载Java1.8 提取码:yi0c 链接:https://pan.baidu.com/s/1mNd2Yg-k6ob91bO ...

  8. 在 Windows 上安装Rabbit MQ 指南

    rabbitMQ是一个在AMQP协议标准基础上完整的,可服用的企业消息系统.他遵循Mozilla Public License开源协议.采用 Erlang 实现的工业级的消息队列(MQ)服务器. Ra ...

  9. 在Windows上安装虚拟机详细图文教程

    用虚拟机来安装最新的软件,安装最新的系统等等比较保险,可以避免安装不顺利影响自己原来的系统和应用,想尝鲜又担心自己完全更换系统不适应的朋友可以尝试. 虚拟机下载:https://yunpan.cn/c ...

随机推荐

  1. 题解:UVA10791 Minimum Sum LCM

    原题 题目大意 输入整数\(n(1\le n<2^{31})\) ,求至少两个正整数,是它们的最小公倍数为$ n$,且这些整数的和最小.输出最小的和. 有多组测试输入,以\(0\)结束. 题解 ...

  2. test20191205 WC模拟赛

    又是先开T3的做题顺序,搞我心态.以后我必须先看看题了. 整数拆分 定义 \(f_m(n)\) 表示将 \(n\) 表示为若干 \(m\) 的非负整数次幂的和的方案数.例如,当 \(m = 2\) 的 ...

  3. python 连接 redis cluster 集群

    一. redis集群模式有多种, cluster模式只是其中的一种实现方式, 其原理请自行谷歌或者百度, 这里只举例如何使用Python操作 redis cluster 集群 二. python 连接 ...

  4. sqoop2的相关配置,启动,停止命令(转)

    原博客地址:http://blog.csdn.net/u012772782/article/details/52949181 sqoop2配置: 一.添加sqoop2到系统环境变量中: export ...

  5. Gamification and Game-Based Learning

    https://uwaterloo.ca/centre-for-teaching-excellence/teaching-resources/teaching-tips/educational-tec ...

  6. 本地部署Easy Mock

    最近在自己捣腾个vue的项目,苦于没有接口测试.网上搜寻一遍,基本上是使用mock.js模拟数据.研究mock.js 过程中,发现很多人提到了Easy Mock,发现它更加的方便.但是访问Eash M ...

  7. windows node版本管理工具nvm

    有时候,不同的项目需要使用不同的node版本.我们可以使用nvm管理不同的node版本.具体使用方法如下: 1.下载安装nvm 点击我下载nvm 解压下载的文件,双击nvm-setup.exe 直接下 ...

  8. PHP函数file_get_contents()使用 https 协议时报错:SSL operation failed

    场景: file_get_contents() 函数是用于将文件的内容读入到一个字符串中,是读取文件内容常用的函数之一. 但是有时在服务器上使用file_get_contents() 函数请求http ...

  9. [PHP] Laravel 5.5 打印SQL语句

    [PHP] Laravel 5.5 打印SQL语句 四种方法 第一种方法: 打印SQL默认是关闭的,需要在/vendor/illuminate/database/Connection.php中打开. ...

  10. 动态规划-多维DP

    1.最大正方形 我的瞎猜分析: 我的瞎猜算法: #include <stdio.h> #include <memory.h> #include <math.h> # ...