Elasticsearch学习记录

Elasticsearch学习记录

安装elasticsearch和kibana

 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
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.13.2
    platform: linux/amd64
    container_name: es
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=false    #关闭密码认证(只在测试环境下运行)
    ports:
      - "9200:9200"
    networks:
      - es-net

  kibana:                              #可视化工具
    image: docker.elastic.co/kibana/kibana:8.13.2
    platform: linux/amd64
    container_name: kibana
    environment:
      - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
    ports:
      - "5601:5601"
    depends_on:
      - elasticsearch
    networks:
      - es-net

networks:
  es-net:

启动:

1
docker compose up -d

image-20250518123809347

访问ES:

1
http://localhost:9200/

image-20250518124044266

浏览器出现上图表示正常。

访问kibana:

1
http://localhost:5601/

image-20250518124143301

Kibana运行查询等命令

image-20250518124526969

点击Dev Tools:

image-20250518124611199

查询全部数据:

1
2
3
4
5
6
GET index/_search
{
  "query": {
    "match_all": {}
  }
}

查询全部索引:

1
GET /_cat/indices?v

May-18-2025 14-45-09

0%