Elasticsearch Index 관리

By | 2020년 6월 22일
Table of Contents

Elasticsearch Index 관리

권장사항

  • 직접 정의된 매핑을 사용하라 : 자동 매핑은 적절하지 않은 매핑을 만들어낸다.

  • 커스텀 anlyzer를 만들어 사용하라

  • 인덱스에 단 하나의 타입(_doc) 만 만들어라.

인덱스 생성

curl -XPUT 'localhost:9200/get-together?pretty' -H 'Content-Type: application/json' -d '{
  "settings" : {
     "index" : {
        "number_of_shards" : 5,
        "number_of_replicas" : 1
     }
  }
}'

인덱스 수정

매핑을 수정할 수 없습니다. 인덱스를 삭제하고 다시 생성하거나, reindex 해야 합니다.

인덱스 조회

curl -XGET 'localhost:9200/get-together/?pretty'

curl -XGET 'localhost:9200/get-together/_settings?pretty'

curl -XGET 'localhost:9200/get-together/_mappings?pretty'

인덱스 삭제

curl -XDELETE 'localhost:9200/get-together/?pretty'

index 열고 닫기

curl -XPOST 'localhost:9200/online-shop/_close'
curl -XPOST 'localhost:9200/online-shop/_open'

답글 남기기