일래스틱서치에서 색인 삭제시 wildcard 와 _all 사용 못하게 설정할 수 있다. 



action.destructive_requires_name=true


설정을 true로 하면, _all 또는 * 를 사용한다.


참고 : https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html



코드를 살펴보면, DestructiveOperations 클래스의 hasWildcardUsage()메소드에서 _all, *에 대한 요청시 destructive_requires_names가 true이면 true임을 리턴한다. 



public final class DestructiveOperations implements NodeSettingsService.Listener {


    /**

     * Setting which controls whether wildcard usage (*, prefix*, _all) is allowed.

     */

    public static final String REQUIRES_NAME = "action.destructive_requires_name";
...


    private static boolean hasWildcardUsage(String aliasOrIndex) {

        return "_all".equals(aliasOrIndex) || aliasOrIndex.indexOf('*') != -1;

    }



...

if (hasWildcardUsage(aliasesOrIndex)) {

                    throw new ElasticsearchIllegalArgumentException("Wildcard expressions or all indices are not allowed");

                }
..
}


Posted by '김용환'
,