The APIs commonly used in Elasticsearch are categorized as follows:
Document API: Provides additions and deletions to documents
Search API: Provides a query for a field on a document
Index API: Provides operations on indexes, view index information, etc.
View API: Return data in more intuitive form, more suitable for console request presentation
Cluster API: An API for viewing and manipulating clusters
The following is a brief introduction to the record.
Document Class API
Index API: Create and build indexes
PUT twitter/tweet/1{"user": "Kimchy", "post_date": "2009-11-15t14:12:12", "message": "Trying Out Elasticsearch"}
Official documentation Reference: Index API.
Get API: Get documents
Curl-xget ' HTTP://LOCALHOST:9200/TWITTER/TWEET/1 '
Official documentation Reference: Get API.
Delete API: Deleting documents
$ Curl-xdelete ' HTTP://LOCALHOST:9200/TWITTER/TWEET/1 '
Official documentation Reference: Delete API.
Update API: Updating documents
PUT test/type1/1{"Counter": 1, "tags": ["Red"]}
Official documentation Reference: Update API.
Multi Get API: Get documents in bulk
Curl ' localhost:9200/_mget '-d ' {"docs": [{"_index": "Test", "_type": "Type", "_id": "1"}, {"_index": "Test", "_t Ype ":" Type "," _id ":" 2 "}]} '
Official documentation Reference: Multi Get API.
Bulk API: Batch operations, batch operations can be performed additions and deletions to search
$ curl-s-xpost localhost:9200/_bulk--data-binary "@requests"; Echo{"took": 7, "errors": false, "items": [{"index": {"_index": "Test", "_type": "Type1", "_id": "1", "_version": 1, "result ":" Created "," Forced_refresh ": false}}]}
Official documentation Reference: Bulk API.
Delete by query API: Remove from query
POST twitter/_delete_by_query{"Query": {"match": {"message": "Some Message"}}}
Official documentation Reference: Delete by Query API.
Update by query API: Updates based on query
POST Twitter/_update_by_query?conflicts=proceed
Official documentation Reference: Update by Query API.
Reindex API: Rebuilding indexes
POST _reindex{"source": {"index": "Twitter"}, "Dest": {"index": "New_twitter"}}
Official documentation Reference: Reindex API.
Term Vectors: Phrase analysis, only for one document
Curl-xget ' Http://localhost:9200/twitter/tweet/1/_termvectors?pretty=true '
Official document reference: Term Vectors.
Multi termvectors API: Phrase analysis for multiple documents
Curl ' localhost:9200/_mtermvectors '-d ' {"docs": [{"_index": "Testidx", "_type": "Test", "_id": "2", "Term_statistics": True}, {"_index": "Testidx", "_type": "Test", "_id": "1", "Fields": ["Text"]}]} '
Official documentation Reference: Multi termvectors API. For more information about the documentation API please refer to: Document APIs.
Search Class API
URI Search:url parameter
GET Twitter/tweet/_search?q=user:kimchy
Official documentation Reference: URI Search.
Request Body Search Interface: The search condition is in the requested body
get/twitter/tweet/_search{"Query": {"term": {"user": "Kimchy"}}}
Official document reference: Request Body Search.
Search Template Settings Interface: You can set the template of the search, the function of the template can be based on different incoming parameters, different actual search
Search for a shard query interface: Query which index and shard the search will use
Suggest interface: Search for suggested interfaces, enter a word, and, depending on a field, return search suggestions.
Bulk Search interface: Put batch request in a file, bulk search interface Read this file, search query
Count interface: Returns only the number of documents that match the search
Document exists interface: Determine if there is a document matching the search exists
Verify interface: Determine if a search request is legitimate and not legally return an error message
Explain interface: Use this interface to return a document whether it conforms to a query, why it conforms to such information
Extractor interface: Simply speaking, you can use this interface to specify that a document conforms to a search, without prior documentation to establish a corresponding search
Official documentation Reference: Search APIS.
Index Class API
Create an Index interface (POST my_index)
Delete Index interface (delete my_index)
Get index Information interface (get My_index)
Whether an index exists interface (HEAD My_index)
Open/Close Index interface (my_index/_close, My_index/_open)
Set Index mapping Interface (PUT my_index/_mapping)
Get index mapping Interface (get my_index/_mapping)
Get field Mapping interface (get My_index/_mapping/field/my_field)
Whether the type exists interface (HEAD My_index/my_type)
Delete Map interface (Delte my_index/_mapping/my_type)
Index alias Interface (_aliases)
Update index Settings interface (PUT my_index/_settings)
Get index Settings interface (get My_index/_settings)
Analysis Interface (_ANALYZE): Analyze how a field is indexed
Establish an Index template interface (_template): Establish a template for the index, which can then be initialized by the newly created index.
Preheating interface (_warmer): Some queries can be pre-warmed, so that the warm-up data stored in memory, increase the efficiency of subsequent queries
State interface (_status): Index status
Bulk Index State Interface (_STATS): Bulk Query Index status
Shard Information Interface (_segments): Provides information at the Shard information level
Index recovery Interface (_recovery): Index recovery operation
Clear Cache Interface (_cache/clear): Clears all caches
Output Interface (_flush)
Flush Interface (_REFRESH)
Optimized interface (_optimize): Optimizing Indexes
Upgrade Interface (_upgrade): The upgrade here refers to the latest format to upgrade the index to Lucence
Official documentation Reference: Indices APIS.
View Class API
View Alias Interface (_cat/aliases): View index aliases
View Allocation Resource interface (_cat/allocation)
View the number of documents interface (_CAT/COUNT)
View field Assignment Interface (_cat/fielddata)
View health status Interface (_cat/health)
View index Information Interface (_cat/indices)
View master Information Interface (_cat/master)
View nodes Information Interface (_cat/nodes)
To view a suspended task interface (_CAT/PENDING_TASKS)
View plug-in interface (_cat/plugins)
Viewing the Repair Status interface (_cat/recovery)
View Line Castle Interface (_cat/thread_pool)
Viewing the Shard Information Interface (_cat/shards)
View Lucence's Segment Information Interface (_cat/segments)
Official documentation Reference: Cat APIS.
Cluster class API
View Cluster health status interface (_cluster/health)
Viewing the cluster status interface (_cluster/state)
Viewing the cluster Statistics interface (_cluster/stats)
View the cluster suspended task interface (_CLUSTER/PENDING_TASKS)
Cluster reroute operation (_cluster/reroute)
Update cluster settings (_cluster/settings)
Node State (_nodes/stats)
Node information (_nodes)
Node's hot line (_nodes/hot_threads)
Close Node (/nodes/_master/_shutdown)
Official documentation Reference: Cluster APIS. At: https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
Common APIs in Elasticsearch