Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use the elasticsearch word splitter

Shulou Source: shulou.com Published: 2022-05-31 14:09:22 10月04日 Update

This article mainly explains "how to use the elasticsearch word splitter". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use the elasticsearch word separator.

1. Create an ik directory under the plugins directory of Elasticsearch, and extract the ik installation package to that directory or. / bin/elasticsearch-plugin install

2. Restart Elasticsearch

3. Test the word separator

GET / _ analyze {"text": "National Emblem of the people's Republic of China", # two: ik_smart coarse-grained split and ik_max_word fine-grained split "analyzer": "ik_max_word"}

4. use the word separator to define the word segmentation in the template.

"settings": {"index": {"number_of_shards": "1", "number_of_replicas": "0"}, "analysis": {"analyzer": {"ik": {"tokenizer": "ik_max_word"}},. "mappings": {"_ doc": {"dynamic_templates": [{"integers": {"mapping": {"type": "long"}, "match_mapping_type": "long" "match": "*"}, {"doubles": {"mapping": {"type": "double"}, "match_mapping_type": "double" "match": "*"}, {"time_mapping": {"match_pattern": "regex", "mapping": {"format": "yyyy-MM-dd HH:mm:ss | | strict_date_optional_time | | epoch_millis" "type": "date"}, "match_mapping_type": "string", "match": ". + (time | Time | TIME | date | Date | DATE)"}, {"ip_match": {"match_pattern": "regex" "mapping": {"type": "ip"}, "match_mapping_type": "string", "match": ". + (IP | Ip | ip | iP)"}, {"port_match": {"match_pattern": "regex" "mapping": {"type": "long"}, "match_mapping_type": "string", "match": ". + (Port | port | PORT)"}}, {"name_mapping": {"match_pattern": "regex" "mapping": {"fields": {"keyword": {"ignore_above": 2560, "type": "keyword"}, "type": "text"} "match_mapping_type": "string", "match": ". + (Name | name)"}, {"strings": {"mapping": {"type": "keyword"}, "match_mapping_type": "string" "match": "*"}], "date_detection": false, "properties": {"content": {"type": "text", "analyzer": "ik_max_word" "fields": {"keyword": {"type": "keyword", "ignore_above": 256}, "level": {"type": "keyword"} "target": {"type": "keyword"}, "source": {"type": "keyword"}, "alerttime": {"type": "date" "format": "yyyy-MM-dd HH:mm:ss"} so far I believe you have a deeper understanding of "how to use the elasticsearch word splitter", so you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Catalogue content granularity learning practical deeper people interest national emblem practicality practical easy to operate method more friends templates websites channels people's Republic of China Republic of China Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MariaDB Docker vpn Redmi