[elasticsearch] path_hierachy 설정

Elastic/Elasticsearch 2013. 6. 20. 15:14

category 나 기타 tree 구조를 갖는 문서속성의 경우 path_hierachy 기능을 사용하면 유용한 부분이 있습니다.

단, 이 기능은 facet 사용은 못하니 참고 하시구요.


{

    "settings" : {

        "index" : {

            "analysis" : {

                "analyzer" : {

                    "path_analyzer" : {"tokenizer" : "path_hierarchy"}

                }

            }

        }

    },

    "mappings" : {

        "category" : {

            "properties" : {

                "category" : {

                    "type" : "multi_field",

                    "fields" : {

                        "name" : { "type" : "string", "index" : "not_analyzed" },

                        "path" : { "type" : "string", "analyzer" : "path_analyzer", "store" : true }

                    }

                }

            }

        }

    }

}



: