ElasticSearch入门 [慕课网课程]

来源:互联网 发布:托尔金完成的书 知乎 编辑:程序博客网 时间:2024/05/17 02:18

原文:http://blog.csdn.net/qwqw3333333/article/category/

 

(一)ElasticSearch单实例安装 

elasticsearch安装: 1 去官方找到下载地址,下载导linux本地 2 解压:tar -vxf 包 3 启动:进入解压后目录: sh ./bin/elasticsearch 界面插件head的安装: 1 进入github,搜索elasticsearch-head 2 选择mobz开头的,在linux下载zip格式文件至本地 3 unzip filename.zip 4...

 

(二)ElasticSearch 分布式安装 

3个节点,1个master2个slave,端口为9200,8200,8000。 配置master 1 进入需要设置为master的主目录,修改config/elasticsearch.yml文件 2 在最后面指定集群名字:cluster.name: chenyulin 3 指定master名字:node.name: master 4 确定指挥官身份:node.master: true... 

 

(三) ElasticSearch基础知识 

结合ElasticSearch的api: { "name" : "master", "cluster_name" : "chenyulin", "cluster_uuid" : "mICgsP3OTKC-oNpcJTQiAQ", "version" : { "number" : "5.6.3", "build... 

 

(四)ElasticSearch索引创建 

RESTFul API 格式:http://:/索引>/类型>/文档id> 常用动词:GET/PUT/POST/DELETE 索引创建:非结构化创建、结构化创建 非结构化创建 粗片框是主分片,细线框是备份分片一一对应。 如何区分结构化与非结构化索引 如何创建结构化索引   1 点击复合查询 2 输入book...

 

(五)ElasticSearch插入数据 

分类:分为指定文档id插入、自动产生文档id插入两类。(文档id是唯一索引指,指向索引数据) 1 自己指定id 点击send,查看响应结果   查看插入得效果   点击数据浏览   2 es产生文档id   响应结果    es中查看...

 

(六)ElasticSearch修改数据 

方式:直接修改、通过脚本修改 直接修改 (1)修改id为1的数据 (2)查看   脚本修改 其它方式注入参数...

 

(七)ElasticSearch删除数据 

删除文档、删除索引 (1)利用Postman删除文档 (2)利用head插件删除索引操作 book索引已经不见了 (3)利用Postman删除索引 删除索引会清空所有数据,所以删除索引操作超级危险,不要轻易删除索引。... 

 

(八)ElasticSearch常用查询语法 

简单查询、条件查询、聚合查询 (1)创建book索引 代码: { "settings":{ "number_of_shards":3, "number_of_replicas":1 }, "mappings":{ "novel":{ "properties":{ "word_count":{ "type":"integer" },...

 

(九)ElasticSearch高级查询语法 

一 子条件查询:特定字段查询所指特定值。分为:Query context和Filter context 1 Query context 概念:在查询中,除了判断文档是否满足查询条件外,ES还会计算一个_score来标识匹配的程度,旨在判断目标文档和查询条件匹配有多好;常用的查询有:全文本查询-针对文本类型数据。字段级别查询-针对结构化数据,如数字、日期等。 1-1 全文本查询:分类... 

 

(十)ElasticSearch源码地址 

https://gitee.com/luckycyl/ElasticSearchDemo... 

 

Ubuntu中启动ElasticSearch报错:max virtual memory areas vm.max_map_count [65530] is too low, increase to a 

1 sudo gedit /etc/sysctl.conf 2 在该文件任意地方加入:vm.max_map_count=655360 3 sudo sysctl -p 4 重启ES... 

 

npm install 安装phantomjs时npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! phantomjs-prebuilt@2.1.15 

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! phantomjs-prebuilt@2.1.15 install: `node install.js` npm ERR! Exit status 1 npm ERR!  npm ERR! Failed at the phantomjs-prebuilt@2.1.15 install...