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. “2018宁夏邀请赛 ” 兼 “The 2019 Asia Yinchuan First Round Online Programming”

    ------------7题弟弟,被各位半小时13题的大佬打惨了(滑稽)---------- 签到题就不写了. F :Moving On            (1247ms) 题意:给定大小为N的带 ...

  2. 品优购项目 单表过程 乒乓过程 入口 MyBatis逆向工程 dubbo框架搭建 品牌表CRUD bug集锦

  3. matplotlib双y周实例e

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

  4. (2)在树莓派安装运行在Python3上的OpenCV

    https://www.jianshu.com/p/56929416b4a1 http://www.eeworld.com.cn/afdz/article_2018030511619.html htt ...

  5. [Algorithm] 21. Merge Two Sorted Lists

    Merge two sorted linked lists and return it as a new list. The new list should be made by splicing t ...

  6. three arrays HDU - 6625 (字典树)

    three arrays \[ Time Limit: 2500 ms \quad Memory Limit: 262144 kB \] 题意 给出 \(a\),\(b\) 数组,定义数组 \(c[i ...

  7. (1)IdentityServer4 V3.0.2-安装模板

    控制台运行命令: dotnet new -i IdentityServer4.Templates

  8. PHP入门之调试

    环境 开发工具VSCode 2019 代码库 自建git 仓库 win7集成环境 PHPStudy2018  具体设置信息:   PHP 5.4.45 ,MySql 5.7 , Apache 2.4 ...

  9. python字符串转整形异常

    python字符串转整形异常 问题 在使用int("xx")转化字符串为整形时,如果字符串是float形式,这样转化会异常 int('3.0') Traceback (most r ...

  10. 如何理解 Web API

    什么是web API? web API 控制器.路由 测试  Web  API  什么是web API ? 简单说,API是接口,访问程序的某一个功能或者数据,实现移动端和客户端的程序之间的数据交互: ...