elasticsearch使用记录
来源:互联网 发布:分析数据的统计处理 编辑:程序博客网 时间:2024/06/04 22:07
最大的特点:
1. 数据库的 database, 就是 index
2. 数据库的 table, 就是 tag
3. 不要使用browser, 使用curl来进行客户端操作. 否则会出现 java heap ooxx...
curl: -X 后面跟 RESTful : GET, POST ...
-d 后面跟数据。 (d = data to send)
1. create:
指定 ID 来建立新记录。 (貌似PUT, POST都可以)
$ curl -XPOST localhost:9200/films/md/2 -d '
{ "name":"hei yi ren", "tag": "good"}'
使用自动生成的 ID 建立新纪录:
$ curl -XPOST localhost:9200/films/md -d '
{ "name":"ma da jia si jia3", "tag": "good"}'
2. 查询:
2.1 查询所有的 index, type:
$ curl localhost:9200/_search?pretty=true
2.2 查询某个index下所有的type:
$ curl localhost:9200/films/_search
2.3 查询某个index 下, 某个 type下所有的记录:
$ curl localhost:9200/films/md/_search?pretty=true
2.4 带有参数的查询:
$ curl localhost:9200/films/md/_search?q=tag:good
{"took":7,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":2,"max_score":1.0,"hits":[{"_index":"film","_type":"md","_id":"2","_score":1.0, "_source" :
{ "name":"hei yi ren", "tag": "good"}},{"_index":"film","_type":"md","_id":"1","_score":0.30685282, "_source" :
{ "name":"ma da jia si jia", "tag": "good"}}]}}
2.5 使用JSON参数的查询: (注意 query 和 term 关键字)
$ curl localhost:9200/film/_search -d '
{"query" : { "term": { "tag":"bad"}}}'
3. update
$ curl -XPUT localhost:9200/films/md/1 -d { ...(data)... }
4. 删除。 删除所有的:
$ curl -XDELETE localhost:9200/films
0 0
- elasticsearch使用记录
- elasticsearch-hadoop使用记录
- elasticsearch的基本使用记录
- ElasticSearch 记录
- [集群搭建]记录使用docker搭建elasticsearch集群
- 如何使用logstash更新已有的elasticsearch记录
- ElasticSearch安装记录
- ElasticSearch删除记录
- elasticsearch学习记录
- elasticsearch安装记录
- Elasticsearch 时区(time_zone)记录
- elasticsearch 运维记录
- elasticsearch基础知识记录
- Elasticsearch安装学习记录
- elasticsearch使用
- ElasticSearch使用
- Elasticsearch使用
- ElasticSearch使用
- HDU 1086 You can Solve a Geometry Problem too
- homework of numerical solution of PDEs
- QML
- 机器没有网络,主机与虚拟机如何设定IP
- Linux环境下提升普通用户权限(sudo)
- elasticsearch使用记录
- PowerPoint颠覆者Prezi 5个月增长1000万用户,总用户突破4000万
- oracle创建对象、删除对象操作
- Eclipse快捷键大全
- Android Google Map API使用的八个步骤---插件生成key
- soapclient
- python登录方正教务系统并保存照片
- 括号配对问题 (栈模拟 简单题)
- 百度云开发clouda学习(一)