분류 전체보기 썸네일형 리스트형 [Elasticsearch] 스케일 아웃 #노드 해체하기 curl -XPUT 'localhost:9200/_cluster/settings' -d '{"transient" : {"cluster.routing.allocation.exclude._ip" : "192.168.1.10"}}' - 재시작을 원하는 노드를 그냥 종료하면 데이터의 손실이다. 위와같이 하면 (192.168.1.10은 해당 노드의 ip) 노드의 데이터들을 다른 노드들이 나눠가지면서 클러스터 green 상태를 유지하면서 재시작이 가능하다. ### 일반적으로 루씬 색인은 21억건 이상의 문서 혹은 2740억건 이상의 고유 텀들을 가질 수 없다. (p410) #롤링 리스타트 - 노드 업그레이드 혹은 설정값을 바꿀 때, 데이터 가용성을 해치지 않으면서 재구동을 하는 방법이다. 과정은 다.. 더보기 [Elasticsearch] Elasticsearch In Action - 7 7.1.1 집계 요청의 구조 curl 'localhost:9200/get-together/group/_search?pretty' -d '{"aggs" : {"top_tags" : {"terms" : {"field" : "tags.verbatim"}}}}' curl 'localhost:9200/get-together/group/_search?pretty' -d '{"query" : {"match" : {"location_group" : "Denver"}},"aggregations" : {"top_tags" : {"terms" : {"field" : "tags.verbatim"}}}}' 더보기 [Elasticsearch] Elasticsearch In Action - 6 유사도 검색 6.1 일래스틱서치에서 점수를 계산하는 방법 #elasticsearch에서의 기본 점수 계산법은 TF-IDF를 기본으로 한다.이는 TF(Term Frequency - 텀의 빈도)의 제곱근 X IDF(Inverse Document Frequency - 텀에 대한 역 문서 빈도의 제곱)X norm(정규화 지수 : 단어의 길이에 반비례) * boost 이다. (p.243) 6.2 다른 점수 방법 #BM25 : 유사도 모듈을 반영 {"mappings" : {"get-together" : {"properties" : {"title" : "string","similarity" : "BM25"}}}} 6.3 부스팅 #색인 혹은 재색인시에 boost를 줄 수 있는데, 질의 시점에 부스팅을 사용하는걸 추천한다.(이유는 .. 더보기 [Elasticsearch] Analyzer #한글 형태소분석기- http://github.com/chanil1218/elasticsearch-analysis-korean- bin/plugin url https://dl-web.dropbox.com/spa/grpekzky9x5y6mc/elastic-analysis-korean/public/elasticsearch-analysis-korean-1.3.0.zip -install analysis-korean#은전한잎- http://bakyeono.net/post/2016-06-03-start-elasticsearch.html- bin/plugin install org.bitbucket.eunjeon/elasticsearch-analysis-seunjeon/2.3.3.0 더보기 [Elasticsearch] download url wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0.2.tar.gz curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0.1.tar.gz 더보기 [Elasticsearch] Monitoring Rest Api 1. 전체 cluster health 체크 http://localhost:9200/_cluster/health?pretty status : green,yellow,red active_primary_shards : primary shard 수 active_shards : primary + replica initializing_shards : restart후 disk에서 읽은 shards 수 unassigned_shards : cluster노드에 수가 적든 무슨원인으로 아직 할당 못한 shard number_of_pending_tasks : 아직 수행못한 변경 http://localhost:9200/_cluster/health?pretty&level=indic.. 더보기 [Elasticsearch] Elasticsearch In Action - 5 5.3 분석 API로 텍스트 분석하기 #settings #analyzer #tokenizer #mapping curl -XPOST 'localhost:9200/myindex?pretty' -d '{ "settings" : {"number_of_shards" : 2,"number_of_replicas" : 1,"index" : {"analysis" : {"analyzer" : {"myCustomAnalyzer" : {"type" : "custom","tokenizer" : "myCustomTokenizer","filter" : ["myCustomFilter1", "myCustomFilter2"],"char_filter" : ["myCustomCharFilter"]}},"tokenizer" : {"myCus.. 더보기 [Elasticsearch] Elasticsearch In Action - 3,4 3.3 배열과 다중 필드 3.3.1 배열 curl -XPUT 'localhost:9200/blog/posts/1' -d ' {"tags" : ["first", "initial"]}'# 배열 필드는 mapping에서 정의하지 않아도 된다. (알아서 해준다) 3.3.2 다중 필드 curl -XPUT 'localhost:9200/blog/_mapping/posts' -d '{"posts" : {"properties" : {"tags" : {"type" : "string","index" : "analyzed","filed" : {"verbatim" : {"type" : "string","index" : "not_analyzed"}}}}}}'# 문자열을 위한 다중 필드: 한 번은 analyzed, 다은 한 번은 .. 더보기 [Elasticsearch] mapping ### Elasticsearch Mapping Exam 기존 mapping에 새로운 필드를 추가하는것은 가능하나 기존의 설정을 변경하는것은 불가능하다. 원한다면 다음 절차대로 해야한다.해당 type의 데이터를 모두 삭제한다.새 매핑을 입력한다.데이터 전체를 다시 색인한다.이유는 기존 매핑 타입과 다른 타입으로 업데이트를 할 경우 (ex. "string" -> "Long") 문제가 생기기 때문. 1. 현재 mapping 상태 확인- curl 'localhost:9200/get-together/_mapping/new-events?pretty' 2. mapping 추가- 기존 매핑에 병합된다.curl -XPUT 'localhost:9200/get-together/_mapping/new-events' -d ' .. 더보기 [config 설정] ##### elasticsearch.yml ##### cluster.name: 클러스터명node.name: 노드명 path.conf: 설정 파일 경로 (default: config/)path.data: 데이터 파일 경로 (default: data/path.work: 임시 작업 파일 경로path.logs: 로그 파일 경로 (default: logs/)path.plugins: 플러그인이 설치되는 경로 bootstrap.mlockall: 자바 가상머신이 엘라스틱서치가 사용하지 않는 메모리를 swap 하는것을 방지시킬 수 있다. (true/false)- true 권장- 시스템 전체 메모리의 50%가 넘지 않도록 하는것이 안정적이다. network.bind_host: 엘라스틱서치 서버의 내부 IP주소network.. 더보기 이전 1 2 3 4 5 6 ··· 14 다음