elasticsearch의 인덱스에 대한 change 여부를 체크하는 방법에 대한 포스트입니다.

1. 시퀀스 번호를 활용한 추적

시퀀스 번호 체크 방법

http://{ip}:9200/_search?seq_no_primary_term=true

Today this can be solved client side by storing the last sequence number and then polling the shard level stats for the current sequence number; if it is higher, there must have been a change. Closing.

마지막 시퀀스 번호를 저장 한 다음 현재 시퀀스 번호의 샤드 레벨 통계를 폴링하여 클라이언트 측에서 해결할 수 있습니다.

https://github.com/elastic/elasticsearch/issues/13830

Determine if the index has been modified · Issue #13830 · elastic/elasticsearch

Today, it is difficult to determine if any index has been updated (e.g., in mostly read only scenarios where the answer becomes more interesting). If you have a simple, outside cache, then it would...

github.com

2. 스택 모니터링의 indices stats 정보, index stats API  히스토리컬 데이터 확인

http://{ip}:9200/_stats

 

http://{ip}:9200/{index}/_stats

https://www.elastic.co/guide/en/kibana/7.5/elasticsearch-metrics.html#indices-overview-page

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html

반응형

이번 포스트는 Elasticsearch를 공부하면서 참고한 자료들을 단순히 주제별로 정리한 포스트입니다.

 

1. ELK 스택

Elasticsearch + Logstash + Kibana 스택 구축 가이드

Digital Ocean - [how to install]

 

2. elasticsearch-dump [엘라스틱서치-덤프]

엘라스틱 서치에 있는 파일들을 json 포맷이나 csv 포맷으로 저장하는 파이썬 모듈 

2.1. Copy

2.2. Backup

 

3.4. merge

curl -XPOST 'localhost:9200/kimchy,elasticsearch/_forcemerge?pretty'

Best way, using reindex API

POST _reindex
{
  "conflicts": "proceed",
  "source": {
  "index": ["twitter", "blog"],
  "type": ["tweet", "post"]
  },
  "dest": {
  "index": "all_together"
  }
}

 

3.5. mapping

PUT post
{
  "mappings":{
    "nulled":{
      "properties":{
        "user":{
        "type":"text"
        },
        "title":{
        "type":"text"
        },
        "detail":{
        "type":"text"
        },
        "url":{
        "type":"text"
        },
        "datetime":{
        "type":"date","format":"YYYY-MM-dd HH:mm"
        }
     }
   }
}



반응형

+ Recent posts