SyntaxHighlighter.all();

1. ElasticSearch vs RDB

ElasticSearch RDB
Get Select
Put Update
Post Insert
Delete Delete

 

2.  인덱스

1) 인덱스 있나 없나 확인

         curl -XGET http://localhost:9200/classes?pretty

 

2) 인덱스 없으면 데이터 생성

         curl -XPUT http://localhost:9200/classes

 

2) 인덱스 없으면 인덱스 생성

         curl -XPUT http://localhost:9200/classes

 

3) 인덱스 지우기

         curl -XDELETE http://localhost:9200/classes

 

4) 인덱스 조회

 

3. Document 

1) Document 생성 및 조회

         curl -XPOST http://localhost:9200/classes/class/1/ -d '{~~~~~~}'

          인덱스명 : classes      , 타입명 : class          , id : 1

 

 

2) Document 생성 및 조회 (파일을 활용)

         curl -XPOST http://localhost:9200/classes/class/1/ -d @test.json

test.json

        *에러 발생 -> 해결

에러 사항

         수정 전 : curl -XPOST http://localhost:9200/classes/class/1/ -d @test.json

         수정 후 : curl -XPOST http://localhost:9200/classes/class/1/ -d @test.json -H 'Content-Type: application/json'

에러 해결

 

3) Document 수정

curl -XPOST http://localhost:9200/classes/class/1/_update?pretty -d '{"doc":{"unit":1}}'

수정 완료

 

 + 추가) 다른 변경 방법

다른 수정 방법으로 수정완료

 

* sarding : 처리 성능 향상을 위해 index를 분산하여 저장하는 것

3) Document 여러개 입력

test2.json 파일

 


참고 : YouTube ( Minsuk Heo 허민석 )

 

 

 

 

 

'빅데이터 > 엘라스틱서치' 카테고리의 다른 글

[ElasticSearch] 엘라스틱서치 구축  (0) 2020.08.20

 

본 게시물은 엘라스틱서치 공부 목적으로,

엘라스틱 서치 관련 구글링해서 나온 것들을 참고하여 구축하였습니다.


 

Test 환경 : Ubuntu server 16.04

다운url : www.elastic.co/kr/downloads/elasticsearch

 

1. 설치 과정

1) FTP를 활용하여 elasticsearch 다운

2) chmod 755 elasticsearch-7.9.0-amd64.deb

3) dpkg -i elasticsearch-7.9.0-amd64.deb

       -> sudo 권한으로 

4) 설치 다되면 reboot

5) sudo systemctl enable easudo systemctl enable elasticsearch.service

       -> 엘라스틱을 안전하게 start/stop 가능

 

2. 사용 명령어

1) 시작

     sudo service elasticsearch start

2) 종료

     sudo service elasticsearch stop

3) 실행되고 있는지 확인

     curl -XGET 'localhost:9200' # check if elasticsearch run

 

 


참고 : YouTube ( Minsuk Heo 허민석 )

+ Recent posts