ElasticSearch docker 설치 - jupark33/Spring GitHub Wiki

  • elasticSearch docker 설치
docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --name esTest elasticsearch:7.1.1
  • kibana docker 설치
docker run -d --link esTest:elasticsearch -p 5601:5601 --name kibana docker.elastic.co/kibana/kibana:7.1.1
  • index 조회
    localhost:9200/_cat/indices?v

  • springboot를 이용한 elasticsearch에 document 추가
    ElasticSearch에 Document 추가

  • kibana에서 ES 다루기

GET messages/_search

GET review/_search

PUT voice
{
  "mappings": {
    "properties": {
      "timestamp": {
        "type": "date",
        "format": "yyyy-MM-dd HH:mm:ss||yyyy/MM/dd||epoch_millis"
      }
    }
  }
}

PUT _ingest/pipeline/timestamp_pipeline
{
  "description": "ES에 데이터 인덱싱 시 기본적으로 인덱싱 완료된 timestamp 가 같이 생성되게 함",
  "processors": [
    {
      "set": {
        "field": "es_timestamp",
        "value": "{{_ingest.timestamp}}"
      }
    }
  ]
}

PUT _template/default_template
{
  "index_patterns": ["*"],
  "settings": {
    "index.refresh_interval": "10s",
    "number_of_replicas": 1,
    "number_of_shards": 15,
    "default_pipeline": "timestamp_pipeline"
  },
  "aliases": {}
}

PUT voice/_doc/2?pipeline=timestamp_pipeline
{
  "name": "gdhong",
  "message": "hi, hello"
}

GET voice/_search
DELETE voice

GET review/_search

PUT messages/_mapping
{
  "properties": {
    "name": { 
      "type":     "text",
      "fielddata": true
    }
  }
}

GET messages/_search

GET fluentd-2024.06.08/_search
GET .kibana_1/_search