본문 바로가기

전체 글

(224)
[Elasticsearch] Reindex 기존 Index에서 analysis 만 바꾸고 싶을 때 사용 하는 API를 알아보자. 1. Template 변경 2. reIndex 실행 3. analysis 변경 확인 4. 검색 쿼리 요청 1. Template 변경 cerebro를 사용해서 index_dump를 만들고 update 한다. 예) my-index -> my-index-dump 2. reIndex 실행 kibana>Dev Tools에서 아래와 같이 간단하게 reIndex가 가능하다. POST _reindex { "source": { "index": "my-index" }, "dest": { "index": "my-index-dump" } } 조건을 붙여서 reIndex하고 싶으면 아래와 같이 "query"문을 넣어서 수행해도 된다. POST..
[파일명] dataFrame을 파일로 저장 시 파일 명 바꾸기 spark에서 아무리 파일 명을 설정해서 저장하고 싶어도 특정 패턴으로 파일 명이 생성 된다... 이때 파일명을 가지고 와서 rename 해주면 원하는 파일 명으로 바꿀 수 있다. import org.apache.hadoop.fs._ val hdfsUrl = "hdfs://nameservice1/user/zeppelin/data/myfolder/" val file_path = "part*" val new_fileName = "nevFile.csv" val fs = FileSystem.get(sc.hadoopConfiguration) val file = fs.globStatus(new Path(hdfsUrl + file_path))(0).getPath().getName() fs.rename(new Path..
[docker] docker localhost ip 확인하기 docker containner 안에서 localhost의 주소는 host PC에서 ifconfig로 쉽게 확인할 수 있다. 1. ifconfig 설치 $sudo apt install net-tools 2. ifconfig 실행 $ifconfig 3. containner 내부에서 curl 실행 확인 curl inetIP:9200
[Elasticsearch] 거리 가중치에 따른 Score 집계 방법 ELK에서 거리 가중치에 따라 score를 받고 싶을 때 사용한다. 하기 쿼리와 같이 "function_score"를 사용하면 거리 별 스코어를 받아 볼 수 있다.(linear 사용) GET your_index_name/_search { "query": { "function_score": { "functions": [ { "linear": {#decay 함수 명 "center": { #좌표 필드 명 "origin": [ 127.00493315155632, 37.57582519652989], "scale": "2km", "offset": "0km", "decay": 0.33 } } } ], "query": { "bool": { "must": [ { "dis_max": { "tie_breaker": 0, "..
Set up basic security for the Elastic Stack ES 기본 보안 설정방법은 아래 링크에 설명되어있다. 따라하다 보면 에러가 발생 할 수 있는대 이를 적어 놓는다... https://www.elastic.co/guide/en/elasticsearch/reference/7.15/security-basic-setup.html Set up basic security for the Elastic Stack | Elasticsearch Guide [7.15] | Elastic Elasticsearch monitors all files such as certificates, keys, keystores, or truststores that are configured as values of TLS-related node settings. If you update a..
python to elasticsearch 파이선에서 elk로 연결하고 bulk update 하는 방법을 알아보자. 기본적으로 ES가 잘 접속 되는지 확인한다. !pip install elasticsearch from elasticsearch import Elasticsearch from elasticsearch import helpers es_client = Elasticsearch("https://localhost:9200/", verify_certs=False) es_client.info() 데이터 null 처리와 날짜 형식 예외 처리 함수가 필요하다. from elasticsearch import Elasticsearch from elasticsearch import helpers from datetime import datetime de..
상호명 규칙 한글 상호명은 특수기호 사용 불가. 영문 상호명은 하기 이미지 기호만 사용 가능 한글 상호명 https://info.help-me.kr/hc/ko/articles/360021088211 영문상호명 https://info.help-me.kr/hc/ko/articles/360024023731
[Crawling] webdriver로 새로운 탭 열고 데이터 수집하기 가끔 크롤링 하다보면 테이블 행 a tag에 링크가 있고 그 링크 안의 데이터를 수집해서 다시 원본 탭으로 돌아오고 싶을 때가 있다. 그럴 때 쓰기 좋은 스크립트를 작성하였으니 참고 하고 입맛에 맏게 수정해서 쓰기 바란다. 새로운 탭 열고 func 수행 후 탭 닫고 복귀 from selenium import webdriver import time driver = webdriver.Chrome('./chromedriver.exe', options=options) driver.get('https://www.google.com/') def openNewTabNExecuteFunction(driver, tabIndex, url, func): # Open a new window driver.execute_scri..
[Elasticsearch] 영문 검색 시 띄어쓰기 제거[2/2] Elk에서 영문 검색 시 띄어쓰기를 하지 않고 연속되는 단어가 있는 경우 검색. kibana에서 실행 하면 된다. index 생성 setting, mapping 입력 tokenize를 사용해 ngram을 설정한다. 최소 2음절씩 최대 5음절로 토큰을 생성한다. PUT english_pattern_replace_test2 { "settings": { "analysis": { "char_filter": { "whitespace_remove": { "type": "pattern_replace", "pattern": "\\s+", "replacement": "" } }, "analyzer": { "custom_analyzer": { "type": "custom", "tokenizer": "my_customer_..
[Elasticsearch] 영문 검색 시 띄어쓰기 제거[1/2] Elk에서 영문 검색 시 띄어쓰기를 하지 않는경우 검색 방법을 알아보자. kibana에서 실행 하면 된다. index 생성 setting, mapping 입력 PUT english_pattern_replace_test { "settings": { "analysis": { "char_filter": { "whitespace_remove": { "type": "pattern_replace", "pattern": "\\s+", "replacement": "" } }, "analyzer": { "custom_analyzer": { "type": "custom", "tokenizer": "whitespace", "filter": ["lowercase", "asciifolding"], "char_filter": [..

반응형