CRUD Elasticsearch (ES) document

New document (the document does not specify ID)

6563032-42e6bf61798b657b.png
New document (the document does not specify ID)

New documents (specified document ID)

6563032-6ebe97554758535e.png
New documents (specified document ID)

Obtain the document through the document ID

6563032-8d7352ff5ef7d28b.png
Obtain the document through the document ID

Update the document by document ID

6563032-0bbd3dc78c9c2161.png
Update the document by document ID

Deleting a document by document ID

6563032-10f615c0edb0c2bf.png
Deleting a document by document ID

New batch documents

6563032-7dc6be850903a648.png
New batch documents

GET batch file

6563032-7eacac2d742b3c9d.png
GET batch file

Search Documents

        Since the main function ES is the massive document search, it provides a rich search interface and syntax, so the use of a separate article describes the ES search function.

Remarks:

        1, specifies the ID generated index document is for export scene data from an external data source to the ES, because there is a data ID of the external data source, the business may also want to keep the same ID, so when entering data can be used existing ES the ID. However, did not let the specified ID ID ES automatically generate good performance, because the ID need to see whether the specified ID already exists.

        2, Bulk writes much higher than a single write performance. Bulk data structures transmission of optimized, did not use the form JSONArray is because the need for additional occupancy and receive data when JSONArray formatted as large memory, it wraps to separate the data more efficient, it does not take up extra memory.

        3, Bulk Request ES will be loaded into memory, if too large, it will decrease performance, requiring repeated attempts an optimal bulk size. 1000 ~ 5000 generally begins from the data, attempts to increase gradually. Further, if we look at the size, it is preferably between 5 ~ 15MB.

        4, it is more efficient than bulk single GET GET, since one need only request the network, reducing the network overhead. Try using bulk GET.

        5, due to the underlying ES is based on Lucene, Lucene has no notion of type, so ES to index each document maintains a property, the property value of type document is located. ES in an index only maintains an index structure that is set at the property and the index of all type. So, the index of the same name a type attribute must be the same, even if they have to maintain the same type in a different type.

        6, same is due to the underlying ES is based on Lucene, once generated in Lucene Segment, it can not be modified. So ES deletes and updates not modify the original data on the hard disk, but to re-generate a data. When Segment do merge, it will delete the old data.

Reproduced in: https: //www.jianshu.com/p/917b55bb8a77

Guess you like

Origin blog.csdn.net/weixin_33834075/article/details/91073099