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. 利用requests库访问360主页20次

    一.安装 1.cmd进入命令行界面 2.直接输入 D:切换至D盘(python所在路径), 然后cd  python下的scripts所在路径,切换至pip所在位置 3.pip install req ...

  2. python的email、smtplib、poplib模块收发邮件

    一封电子邮件的旅程是: MUA:Mail User Agent--邮件用户代理.(即类似Outlook的电子邮件软件) MTA:Mail Transfer Agent--邮件传输代理,就是那些Emai ...

  3. Java Excel 导入导出(一)

    本文主要描述通过java实现Excel导入导出 一.读写Excel三种常用方式 1.JXL——Java Excel开放源码项目:读取,创建,更新 2.POI——Apache POI ,提供API给Ja ...

  4. 进程控制块 与 task_struct

    http://blog.csdn.net/qq_26768741/article/details/54348586 struct task_struct { volatile long state;  ...

  5. matplotlib双y周实例e

    import pandas as pdimport numpy as npimport matplotlib.pyplot as pltimport pymysqlimport warningsimp ...

  6. kuma 学习二 centos 安装

    前边有使用minikube运行kuma,以下是在centos 上安装使用 环境准备 下载软件包 wget https://kong.bintray.com/kuma/kuma-0.1.1-centos ...

  7. 关于api创建监控项,添加灵活调度的事件间隔

    在api文档中没有明确说明,可以查询数据库,得到的是一个字符串,

  8. js处理事件冒泡(兼容写法)

    event = event || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event. ...

  9. vue.js动态绑定input的checked

    不管<input type='radio checked='true''>  你的checked属性值是true或者false,他都会选中. 其实原理是这样的,复选框里只要有checked ...

  10. [技术博客]采用Bootstrap框架进行排版布局

    [技术博客]采用Bootstrap框架进行排版布局 网页的前端框架有很多很多种,比如Bootstrap.Vue.Angular等等,在最开始其实并没有考虑到框架这回事,开始阅读往届代码时发现其部分采用 ...