Adding & Updating analyzer in existing index

이상민·2021년 5월 11일
0
post-thumbnail

1. Adding analyzer to existing index

  • using settings api
PUT /analyzer_test/_settings
{
    "analysis" : {
        "analyzer" : {
            "my_second_analyzer" : {
                (... analyzer settings ...)
            }
        }
    }
}
  • error will occur stating that non-dynamic settings for open indexes cannot be updated

1-1. open & close index

  • open index : available for indexing and search requests
  • close index : refuse requests

1-2. dynamic & static settings

  • Dynamic settings : can be changed without closing the index

  • Static settings : require index to be closed

  • analysis settings are static settings, to change static settings,

    • first close index with close API
    • then change settings
    • reopen index with open API
POST /analyzer_test/_close
PUT /analyzer_test/_settings
{
    "analysis" : {
        "analyzer" : {
            "my_second_analyzer" : {
                (... analyzer settings ...)
            }
        }
    }
}
POST /analyzer_test/_open

1-3. static settings on production env

  • for mission critical production systems
    • create new index with updated settings
    • use index alias for the transition

2. Updating analyzer in existing index

  • to update analyzers, PUT request full settings with the same analyzer name
    • there will be conflict between docs index before the analyzer update and after
    • use update by query API to reindex
POST analyzer_test/_update_by_query?conflicts=proceed
profile
편하게 읽기 좋은 단위의 포스트를 추구하는 개발자입니다

0개의 댓글