Elasticsearch 笔记

Elasticsearch: 7.4.0

Intro

官网:https://www.elastic.co/

Install

Docker

1
docker run -d --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.4.0

UI

Settings

CORS

1
2
http.cors.enabled: true
http.cors.allow-origin: "*"

REST API Examples

_index

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
POST xxx-index-2020-04-10/_doc/1
{
"cluster": "primary-dc",
"reason": "Total timeout 1000 ms elapsed",
"hostname": "9ddf7031ac70",
"partition": 0,
"offset": 21,
"messageId": "70df2035-3c81-4ebf-8f76-a396ee1f94fc",
"topicName": "T2.g2.t1",
"subscription": "my-Subscription1",
"batchId": "",
"publish_timestamp": 1587010729737,
"timestamp": 1587010742388,
"status": "DISCARDED"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
GET xxx-index-wildcard-*/_search
{
"from": 0,
"size": 20,
"sort": [
{
"timestamp": {
"unmapped_type": "date",
"order": "asc"
}
}
],
"query": {
"bool": {
"must": [
{
"term": {
"topicName.keyword": {
"value": "T2.g2.t1"
}
}
},
{
"term": {
"subscription.keyword": {
"value": "my-Subscription1"
}
}
}
]
}
}
}

_alias

1
2
POST xxx-index-2020-04-20/_alias/xxx-index-alias
{}