Additions and deletions change the use of the document API in Elasticsearch

Source: Internet
Author: User
Tags syslog logstash

What is the document? An object is equivalent to a record recording of MySQL


Reference:

Http://www.learnes.net/data/README.html


Curl 192.168.100.10:9200?preetycurl 192.168.100.10:9200/_count?pretty


Usage of curl in the shell

-x specifies that the request method defaults to-xget

-I also return the request result when I return the data

-D Data sent



This return value means that our index request has been successfully created, including _index, _type, and _id metadata, as well as a new element _version

_index nouns are equivalent to libraries in the database

_type equivalent to a table in a database

_ID is the ID (which can be specified and self-increment)


_index and _type and _id are the only ones that make up the data in the Elasticsearch store


Create a

Curl-xput 192.168.100.10:9200/website/blog/123-d ' {"title": "My First blog entry", "Text": "Just trying this out ...", "Date": "2016/01/01"} '



You can see the document that was created at the time you searched

[[email protected] ~]# Curl 192.168.100.10:9200/website/blog/123?pretty {"_index": "website", "_type": "blog", "_id" : "123", "_version": 1, "found": true, "_source": {"title": "My First blog entry", "Text": "Just trying th Is out ... "," date ":" 2014/01/01 "}}

For each situation found:

[Email protected] ~]# Curl 192.168.100.10:9200/website/blog/1235?pretty{"_index": "website", "_type": "blog", "_id" : "1235", "found": false}


_source is the content of the document. You can specify a value to return the field specified by the document

[Email protected] ~]# curl-i-xget "192.168.100.10:9200/logstash-2016.05.12/syslog/avsliby3bzztddjuagzh?_source= File,meesage&pretty "http/1.1 Okcontent-type:application/json;   charset=utf-8content-length:185{"_index": "logstash-2016.05.12", "_type": "Syslog", "_id": "Avsliby3bzztddjuagzh", "_version": 1, "found": true, "_source": {"file": "/var/log/messages"}}



Get multiple documents at once _mget

[[email protected] ~]# curl-i-xget 192.168.100.10:9200/logstash-2016.05.12/syslog/_mget?pretty-d ' {"IDs": ["2", "1"]} ' http/1.1 Okcontent-type:application/json; charset=utf-8content-length:230{"Docs": [{"_index": "logstash-2016.05.12", "_type": "Syslog", "_id": "2"  , "Found": false}, {"_index": "logstash-2016.05.12", "_type": "Syslog", "_id": "1", "found": false } ]}



This article is from the "Tridewah operation and maintenance work Road" blog, please be sure to keep this source http://cuidehua.blog.51cto.com/5449828/1772867

Additions and deletions change the use of the document API in Elasticsearch

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.