elasticsearch的基本用法
来源:互联网 发布:怎么登录ebsco数据库 编辑:程序博客网 时间:2024/06/07 13:37
最大的特点:
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 带有参数的查询:
{"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
- elasticsearch的基本用法
- elasticsearch的基本用法
- elasticsearch的基本用法
- elasticsearch的基本用法
- elasticsearch的基本用法
- elasticsearch的基本用法
- ElasticSearch的基本用法与集群搭建
- ElasticSearch的基本用法与集群搭建
- ElasticSearch的基本用法与集群搭建
- ElasticSearch的基本用法与集群搭建
- Elasticsearch的基本使用
- ElasticSearch的基本安装
- elasticsearch的基本使用记录
- 【Elasticsearch】query_string的各种用法
- ELK中elasticsearch的用法
- elasticsearch详解(四)——elasticsearch数据的基本操作
- Elasticsearch(十一)elasticsearch搜索--最基本的工具
- Elasticsearch用法
- Edit Control按回车表示点击Button1
- C++ String类的实现
- android 返回值 实现 home键的效果
- 9.4 触摸和手势:事件的传递的机制
- 28 大数阶乘
- elasticsearch的基本用法
- CSU-ACM暑假集训基础组训练赛(1) B - Problem B
- 关于同步的几个问题
- ios中数字的格式化(金额千分位格式化显示)
- MFC学习笔记(2)—— 消息(1)
- 随记
- Difference between proxy server and reverse proxy server
- USACO maze1 BFS
- 使用UrlRewriteFilter如何在Tomcat crossContext的情况下上传文件