참조 : http://c.tistory.com/243



PUT /cine21

{

  "settings": {

    "analysis": {

      "analyzer": {

        "korean_analyzer" : {

          "type" : "custom",

          "tokenizer": "korean_tokenizer",

          "filter" : ["stop", "lowercase", "trim", "synonym"]

        },

        "ngram_analyzer" : {

            "type" : "custom",

            "tokenizer" : "ngram_tokenizer",

            "filter" : ["lowercase", "trim","synonym"]

        },

        "edge_ngram_analyzer" : {

            "type" : "custom",

            "tokenizer" : "edge_ngram_tokenizer",

            "filter" : ["lowercase", "trim","synonym"]

        }

      },

      "tokenizer": {

        "korean_tokenizer": {

          "type": "mecab_ko_standard_tokenizer",

          "compound_noun_min_length": 100

        },

        "ngram_tokenizer" : {

            "type" : "nGram",

            "min_gram" : "1",

            "max_gram" : "5",

            "token_chars": [ "letter", "digit", "punctuation", "symbol" ]

        },

        "edge_ngram_tokenizer" : {

            "type" : "edgeNGram",

            "min_gram" : "1",

            "max_gram" : "5",

            "token_chars": [ "letter", "digit", "punctuation", "symbol" ]

        }        

      },

      "filter": {

        "synonym" : {

            "type" : "synonym",

            "synonyms" : [

                "탐, 톰",

                "플래이어, 플레이어"

            ]

        }

      }

    }

  }, 

  "mappings": {

    "movie" : {

      "analyzer" : "korean_analyzer",

      "index_analyzer" : "edge_ngram_analyzer",

      "search_analyzer" : "edge_ngram_analyzer",

      "properties": {

        "title" : {

          "type": "string", 

          "fields" : {

            "h_pf" : {"type" : "string", "store" : "no", "index" : "not_analyzed", "omit_norms" : true, "index_options" : "offsets", "term_vector" : "with_positions_offsets", "include_in_all" : false, "boost": 20},

            "h_ko" : {"type" : "string", "index_analyzer" : "korean_analyzer", "boost": 3},

            "h_ng" : {"type" : "string", "index_analyzer" : "ngram_analyzer", "boost": 1},

            "h_ed" : {"type" : "string", "index_analyzer" : "edge_ngram_analyzer", "boost": 2}

          }

        }

      }

    }

  }

}





GET /cine21/_search





GET /cine21/_search

{

  "query": {

    "bool": {

      "should": [

        {"prefix": {

          "title.h_pf": "창"

        }},{"term": {

          "title.h_ko": "창"

        }},{"term": {

          "title.h_ed": "창"

        }},{"term": {

          "title.h_ng": "창"

        }}

      ],

      "minimum_should_match": 1

    }

  }

}



출처: http://c.tistory.com/243 [coens TISTORY]

출처: http://c.tistory.com/243 [coens TISTORY]

출처: http://c.tistory.com/243 [coens TISTORY]

+ Recent posts