(五)创建文档及索引


2.id自增
$ curl -XPOST 'http://localhost:9200/twitter/tweet/' -d '{
    "user" : "kimchy",
    "post_date" : "2009-11-15T14:12:12",
    "message" : "trying out Elasticsearch"
}'


3.指定id(使用sense工具)
http://IP:9200/index/test/2

PUT   
{
  "title": "kimchy",
  "content": "Trying out elasticsearch, so far so good?"
}

   相当于CURL

$ curl -XPUT 'http://localhost:9200/index/test/1' -d '{
"title": "kimchy",
  "content": "Trying out elasticsearch, so far so good?"
}'
4.parent&child
以下内容为网上摘抄,并未实践
$ curl -XPUT localhost:9200/blogs/blog_tag/1122?parent=1111 -d '{
    "tag" : "something"
}'
 
 

5.TTL。一个文档建立索引的时候,能够为其指定ttl。文章的过期时间。1d:过期时间为1天

curl -XPUT 'http://localhost:9200/twitter/tweet/1?ttl=86400000' -d '{
  "user": "kimchy",
  "message": "Trying out elasticsearch, so far so good?"
}'
curl -XPUT 'http://localhost:9200/twitter/tweet/1?ttl=1d' -d '{
  "user": "kimchy",
  "message": "Trying out elasticsearch, so far so good?"
}'
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{
  "_ttl": "1d",
  "user": "kimchy",
  "message": "Trying out elasticsearch, so far so good?"
}'


6.TimeOut
$ curl -XPUT 'http://localhost:9200/twitter/tweet/1?timeout=5m' -d '{
    "user" : "kimchy",
    "post_date" : "2009-11-15T14:12:12",
    "message" : "trying out Elasticsearch"
}'

转载于:https://www.cnblogs.com/A-tingzi/p/7145848.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值