ElasticSearch简单介绍
2016-05-24 11:20
766 查看
ElasticSearch
1、网址
官方网址:https://www.elastic.co/
文档地址:https://www.elastic.co/guide/index.html(教程加权威指南)
2、版本
1.5(此版本要求jdk 1.7.50及以上)
3、安装
3.1 配置java环境变量(jdk 1.7.50及以上)
3.2 下载压缩包、解压
3.3 运行
(如果不加-d参数,会前台运行,退出的时候进程也就停止了)
4、配置
4.1配置文件路径config下的elasticsearch.yml(主配置文件)、logging.yml(日志)
4.2 主要配置项说明
5、启动文件设置
5.1 打开bin/elasticsearch
5.2保存即可
6、查询语句
6.1增删改查
增索引
索引别名(更平顺的迁移数据,不影响线上)
增Mapping
增加文档
根据Id查找
删除
更新
6.1 query(分词查询,全文检索),
6.2 filter(普通查询)
1、网址
官方网址:https://www.elastic.co/
文档地址:https://www.elastic.co/guide/index.html(教程加权威指南)
2、版本
1.5(此版本要求jdk 1.7.50及以上)
3、安装
3.1 配置java环境变量(jdk 1.7.50及以上)
3.2 下载压缩包、解压
3.3 运行
./bin/elasticsearch –d
(如果不加-d参数,会前台运行,退出的时候进程也就停止了)
4、配置
4.1配置文件路径config下的elasticsearch.yml(主配置文件)、logging.yml(日志)
4.2 主要配置项说明
cluster.name: xxx #集群名称 node.name: "xxx" #节点名称 index.number_of_shards: 5 #分片数量(每台机器的分片数数据分散到每个片上,减少每个片的总数据量,加快查询速度) index.number_of_replicas:1 #复制数量(每个分片的备份数,保证数据的完整性) bootstrap.mlockall: true #锁定内存 network.host: xxx.xxx.xxx.xxx #设置本机地址和发布地址 transport.tcp.port: 9300 #TCP访问端口 http.port: 9200 #HTTP访问端口 #集群间通讯超时以及频次设置 discovery.zen.ping.timeout: 60s discovery.zen.fd.ping_interval: 5s discovery.zen.fd.ping_timeout: 60s discovery.zen.fd.ping_retries: 5 discovery.zen.ping.multicast.enabled: false #不使用广播 discovery.zen.ping.unicast.hosts: ["ip:port"] #其他机器地址,多个用逗号分隔 #以下为慢查询时间设置 index.search.slowlog.threshold.query.warn: 10s index.search.slowlog.threshold.query.info: 5s index.search.slowlog.threshold.query.debug: 2s index.search.slowlog.threshold.query.trace: 500ms http.cors.enabled: true #允许head插件访问
5、启动文件设置
5.1 打开bin/elasticsearch
5.2保存即可
6、查询语句
6.1增删改查
增索引
$ curl -XPUT 'http://localhost:9200/twitter/'
索引别名(更平顺的迁移数据,不影响线上)
curl -XPOST 'http://localhost:9200/_aliases' -d ' { "actions" : [ { "add" : { "index" : "test1", "alias" : "alias1" } } ] }'
增Mapping
$ curl -XPUT 'http://localhost:9200/twitter/_mapping/tweet' -d ' { "tweet" : { "properties" : { "message" : {"type" : "string", "store" : true } } } } '
增加文档
$ curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{ "user" : "kimchy", "post_date" : "2009-11-15T14:12:12", "message" : "trying out Elasticsearch" }'
根据Id查找
curl -XGET 'http://localhost:9200/twitter/tweet/1'
删除
$ curl -XDELETE 'http://localhost:9200/twitter/tweet/1'
更新
curl -XPOST 'localhost:9200/test/type1/1/_update' -d '{ "doc" : { "name" : "new_name" } }'
6.1 query(分词查询,全文检索),
6.2 filter(普通查询)
相关文章推荐
- 巧用mysql提示符prompt清晰管理数据库的方法
- 两大步骤教您开启MySQL 数据库远程登陆帐号的方法
- phpmyadmin 4+ 访问慢的解决方法
- linux系统下实现mysql热备份详细步骤(mysql主从复制)
- CentOS 5.5下安装MySQL 5.5全过程分享
- MySQL复制的概述、安装、故障、技巧、工具(火丁分享)
- MySQL中删除重复数据的简单方法
- 使用ElasticSearch6.0快速实现全文搜索功能的示例代码
- elasticsearch批量数据导入和导出
- 使用ElasticSearch+LogStash+Kibana+Redis搭建日志管理服务
- ElasticSearch 使用心得
- ES中如何使用逗号来分词
- ElasticSearch 守护进程 JSW
- Elasticsearch2.2.0数据操作
- Elasticsearch2.2.0安装ik中文分词
- Elasticsearch2.2.0安装pinyin插件
- ELK(ElasticSearch, Logstash, Kibana)搭建实时日志分析平台
- CENTOS安装ElasticSearch
- ElasticSearch的安装配置
- elasticsearch 1.0 升级2.2的数据备份和恢复