端点:
1. 用于搜索数据的端点:_search / _query
_search 用于进行搜索查询,返回查询结果。
_query用于执行删除操作。
2.分析端点:_analyze
用于对查询参数进行分析,并返回分析的结果
3.计数端点:_count
在计数端点_count上,执行查询,获取满足查询条件的文档数量
4. 解释端点:_explain
用于验证指定的文档是否满足查询条件,格式是index/type/_id/_explain
集群健康
GET _cluster/health
得到集群的健康信息:
{
"cluster_name": "elasticsearch",
"status": "yellow", //集群工作是否正常,green 所有主分片和副本分片都正常运行;yellow 所有主分片都正常运行,但不是所有的副本分片都正常运行;red 有主分片没能正常运行。
"timed_out": false,
"number_of_nodes": 1,
"number_of_data_nodes": 1,
"active_primary_shards": 5,
"active_shards": 5,
"relocating_shards": 0,
"initializing_shards": 0,
"unassigned_shards": 5,
"delayed_unassigned_shards": 0,
"number_of_pending_tasks": 0,
"number_of_in_flight_fetch": 0,
"task_max_waiting_in_queue_millis": 0,
"active_shards_percent_as_number": 50
}
当在同一台机器上启动了第二个节点,只要它的cluster.name配置和第一个节点相同,就可以自动发现集群并加入其中。
更为详细基础的Elasticsearch集群内的原理:https://www.elastic.co/guide/cn/elasticsearch/guide/current/distributed-cluster.html