1. 엘라스틱서치 실행
systemctl start elasticsearch
2. 엘라스틱서치 실행 상태 확인하기
systemctl status elasticsearch
3. 인덱스 조회하기
curl -XGET localhost:9200/_cat/indices?v
4. test 이름을 갖는 인덱스 생성하고 인덱스 조회해보기
curl -XPUT localhost:9200/test?pretty
curl localhost:9200/_cat/indices?v
5. 도큐먼트 추가해보기
curl -XPOST localhost:9200/test/info/1?pretty -H 'Content-Type: application/json' -d'
{
"name": "park"
}
'
6. 도큐먼트 조회하기
curl -XGET localhost:9200/test/_search?pretty
7. id를 통해 조회해보기
curl -XGET localhost:9200/test/info/1?pretty
8. id를 통해 조회하고 source 부분만 출력해보기
curl -XGET 'localhost:9200/test/info/1?pretty&filter_path=_source'
9. 1번 id에 "age": 10 으로 다시 생성해보기
curl -XPOST localhost:9200/test/info/1?pretty -H 'Content-Type: application/json' -d'
{
"age": 10
}
'
10. test 인덱스의 도큐먼트 조회해보기
curl -XGET localhost:9200/test/_search?pretty
11. 1번 id 도큐먼트 조회해보기
curl localhost:9200/test/info/1?pretty
12. 도큐먼트 삭제해보기
curl -XDELETE localhost:9200/test/info/1?pretty
13. 삭제된 도큐먼트 조회해보기
curl -XGET localhost:9200/test/info/1?pretty
14. 인덱스 제거해보기
curl -XDELETE localhost:9200/test
15. 인덱스 전체 조회
curl localhost:9200/_cat/indices?v
'Database > ElasticSearch' 카테고리의 다른 글
[elasticsearch] 엘라스틱서치 예제 및 문법 공부 4 (0) | 2021.06.09 |
---|---|
[elasticsearch] 엘라스틱서치 예제 및 문법 공부 3 (0) | 2021.06.09 |
[elasticsearch] 엘라스틱서치 예제 및 문법 공부 1 (0) | 2021.06.08 |
[elasticsearch] 엘라스틱서치 실행하기 (0) | 2021.06.08 |
[logstash] 로그스태시란 (0) | 2021.06.06 |