본문 바로가기

Elasticsearch

[Elasticsearch] curl create index, delete index 인덱스 생성 삭제

반응형

 

 

curl index create / 인덱스 생성 & curl index delete / 인덱스 삭제

+ Elasticsearch AWS APIKEY 로 요청 보내기 

 

 

CREATE 

Index 생성 요청 / to create an index 

curl -XPUT "{host}:{port}/{index}"

API KEY 필요한 경우 / with an API KEY

curl -H "Authorization:ApiKey [your API KEY]" -XPUT "{host}:{port}/{index}"

 

 

DELETE

Index 삭제 요청 / to delete an index

curl -XDELETE "{host}:{port}/{index}"

API KEY 필요한 경우 / with an API KEY 

curl -H "Authorization:ApiKey [your API KEY]" -XDELETE "{host}:{port}/{index}"

 

 

Examples) 

CREATE 

- localhost

curl -XPUT "https://localhost:9200/my-index"

- aws with an API KEY 

curl -H "Authorization:ApiKey [your API KEY]" -XPUT "https://blabla.ap-northeast-2.aws.elastic-cloud.com:9243/my-index"

 

DELETE

- localhost

curl -XDELETE "https://localhost:9200/my-index"

- aws with an API KEY 

curl -H "Authorization:ApiKey [your API KEY]" -XDELETE "https://blabla.ap-northeast-2.aws.elastic-cloud.com:9243/my-index"

 

 

 

 

 

 

 

 

 

 

 

Reference : https://www.elastic.co/guide/en/elasticsearch/reference/current/http-clients.html

반응형