最大的特点:
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

http://bbs.csdn.net/topics/300052325

ElasticSearch基本用法的更多相关文章

  1. Elasticsearch SQL用法详解

    Elasticsearch SQL用法详解  mp.weixin.qq.com 本文详细介绍了不同版本中Elasticsearch SQL的使用方法,总结了实际中常用的方法和操作,并给出了几个具体例子 ...

  2. Elasticsearch match_phrase用法

    目前有用到的用法如下: post /index_name/_search { "query" : { "match_phrase": { "nickn ...

  3. Elasticsearch常见用法-入门

    前台启动 默认是只有本地可以访问 ./bin/elasticsearch 远程访问 修改elasticsearch.yml,把network.host(注意配置文件格式不是以 # 开头的要空一格, : ...

  4. Elasticsearch基本用法(2)--Spring Data Elasticsearch

    Spring Data Elasticsearch是Spring Data项目下的一个子模块. 查看 Spring Data的官网:http://projects.spring.io/spring-d ...

  5. Elasticsearch基本用法(1)--原生操作

    2.2.创建索引 2.2.1.语法 创建索引的请求格式: 请求方式:PUT 请求路径:/索引库名 请求参数:json格式: { "settings": { "number ...

  6. rails elasticsearch searchkick用法

    1.安装elasticsearch 之前要先安装java8: 参考https://www.elastic.co/guide/en/elasticsearch/reference/current/zip ...

  7. Elasticsearch常见用法-分布式集群

    集群内部工作方式 Elasticsearch用于构建高可用和可扩展的系统.扩展的方式可以是购买更好的服务器(纵向扩展(vertical scale or scaling up))或者购买更多的服务器( ...

  8. elasticsearch 基本用法

    最大的特点: 1. 数据库的 database, 就是  index 2. 数据库的 table,  就是 tag 3. 不要使用browser, 使用curl来进行客户端操作.  否则会出现 jav ...

  9. ElasticSearch使用spring-data-elasticSearch的用法

    spring-data-Elasticsearch 使用之前,必须先确定版本,elasticsearch 对版本的要求比较高. spring和elasticsearch有两种链接方式,一种是用TCP协 ...

随机推荐

  1. SQL Server索引进阶:第十二级,创建,修改,删除

    在第十级中我们看到了索引的内部结构,在第十一级中我们看到了平衡树结构潜在的负面影响:索引碎片.有了索引内部结构的知识,我们可以检查在执行数据定义语句和数据操作语句的时候,都发生了什么.在本级中我们介绍 ...

  2. CSS3 旋转3D立方体

    <meta charset="utf-8"> <style> *{ margin:0px; padding:0px; } @-webkit-keyframe ...

  3. 性能优化工具---sar

    简介: System Activity Reporter系统活动情况报告 下载地址: http://pagesperso-orange.fr/sebastien.godard/download.htm ...

  4. Oracle死锁。

    oracle数据库死锁一般情况下在oracle数据库中不会.但是在程序中可以开启事物没有提交,但是程序报错我们就关了程序在重新调试.但是我们程序总是在执行 comm.ExecuteNonQuery() ...

  5. SET ANSI_NULLS (Transact-SQL)

    指定在 SQL Server 2014 中与 Null 值一起使用等于 (=) 和不等于 (<>) 比较运算符时采用符合 ISO 标准的行为. 当 SET ANSI_NULLS 为 ON ...

  6. calltree看代码调用图

    calltree是在linux下面看c代码(尤其是复杂的内核代码)的神器. 推荐  calltree+vim + ctags + cscope + taglist [ vim: 搭建vim看代码的环境 ...

  7. VS2010断点无效

    可能的原因如下: 1. 菜单tools->Options->Debugging->General,有个Require  source files to exactly match t ...

  8. 练习:一只豆瓣电影TOP250的爬虫

    练习:一只豆瓣电影TOP250爬虫 练习:一只豆瓣电影TOP250爬虫 ①创建project ②编辑items.py import scrapyclass DoubanmovieItem(scrapy ...

  9. 一周学会Mootools 1.4中文教程:(1)Dom选择器

    利器: 君欲善其事须先利其器,好吧因为我们的时间比较紧迫,只有六天而已,那么六天的时间用死记硬背的方式学会Mt犹如天方夜谭,因此我们需要借鉴一下Editplus的素材栏帮我们记忆就好了,当我们需要用到 ...

  10. 不包含任何UserControl

    奇怪了,以前做控件的时候都没有这个问题,哎,又堕落了1年,什么都忘了 创建自定义控件 可以继承现有控件,也可以继承userContrl类,但是现在有个问题 很多网上的资料说,啊,直接创建一个自定义控件 ...