TEST ํ๊ฒฝ
- ES ๋ฒ์ : 7.11.2
๐ ElasticSearch์ ์ธ๋ฑ์ค ์กฐํ, ์์ฑ, ์ญ์ ๋ช ๋ น์ด
1) ElasticSearch Cluster ์ํ ํ์ธ
- ๋ช ๋ น์ด
curl --location --request GET 'http://localhost:9200/_cat/health?v'
- ๊ฒฐ๊ณผ
2) ์ธ๋ฑ์ค ์กฐํ
- ๋ช ๋ น์ด
curl --location --request GET 'http://localhost:9200/_cat/indices?v'
- ๊ฒฐ๊ณผ
3) ์ธ๋ฑ์ค ์์ฑ
- ๋ช ๋ น์ด
curl --location --request PUT 'http://localhost:9200/books(์์ฑํ ์ธ๋ฑ์ค ์์ฑ)'
- ๊ฒฐ๊ณผ
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "test"
}
4) ์ธ๋ฑ์ค ์ญ์
- ๋ช ๋ น์ด
curl --location --request DELETE 'http://localhost:9200/books(์ญ์ ํ ์ธ๋ฑ์ค ์์ฑ)'
- ๊ฒฐ๊ณผ
{ "acknowledged": true }
๐ ์ธ๋ฑ์ค ์์ฑ ์, Setting/Mapping ์ค์ ํ๊ธฐ
์ธ๋ฑ์ค๋ฅผ ์์ฑํ ๋ setting, mapping์ ์ค์ ํ ์ ์๋ค.
๋ฌผ๋ก , ์ด๊ธฐ์๋ง ์ ํ ํ ์ ์๋ ๊ฒ์ ์๋๋ค. ์์ธ์ด ์์ฑ๋ ํ, mapping์ ์ถ๊ฐํ์ฌ ํ์ฅํ ์ ์๋ค.
๊ทธ๋ฌ๋, ์ธ์ ๋ ํ์ฅ์ด ์ด๋ฃจ์ด์ง๋ ๊ฑด ์๋์ ๋ช ์ฌํ์.
์์ธ์ด ์์ฑ๋ ํ์ ๋ ํ๋ฆฌ์นด์ ์๋ ๋ณ๊ฒฝํ ์ ์์ผ๋, ์ค๋ ์๋ ๋ณ๊ฒฝ์ด ๋ถ๊ฐํ๋ค.
๐ Setting
ES ์ธ๋ฑ์ค Setting ์กฐํ
- ๋ช ๋ น์ด
curl --location --request GET 'http://localhost:9200/nori_sample(์ธ๋ฑ์ค ์ด๋ฆ ์์ฑ)/_settings'
- ๊ฒฐ๊ณผ(์๋ต
{
"nori_test": {
"settings": {
"index": {
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"number_of_shards": "1",
"provided_name": "nori_test",
"creation_date": "1622968144285",
"analysis": {
"filter": {
"edge3Gram": {
"min_gram": "1",
"side": "front",
"type": "edgeNGram",
"max_gram": "3"
}
},
"analyzer": {
"nori_analyzer": {
"filter": [
"edge3Gram",
"lowercase"
],
"type": "custom",
"tokenizer": "nori_user_dict"
}
},
"tokenizer": {
"nori_user_dict": {
"user_dictionary": "userdict_ko.txt",
"decompound_mode": "mixed",
"tokenize_on_chars": [
"whitespace",
"-",
"\n"
],
"type": "nori_tokenizer",
"discard_punctuation": "false"
}
}
},
"number_of_replicas": "1",
"uuid": "jAlgkYzmSeesJU2u-8eysg",
"version": {
"created": "7110299"
}
}
}
}
}
๐ Mapping
Mapping ์กฐํ
- ๋ช ๋ น์ด
curl --location --request GET 'http://localhost:9200/nori_sample(์ธ๋ฑ์ค ์ด๋ฆ ์์ฑ)/_mapping'
- ๊ฒฐ๊ณผ
{
"nori_test": {
"mappings": {
"properties": {
"base": {
"type": "text"
},
"word": {
"type": "text",
"fields": {
"one": {
"type": "text",
"analyzer": "nori_analyzer"
},
"two": {
"type": "text",
"analyzer": "nori_analyzer"
}
}
}
}
}
}
}
๐ ์ฐธ๊ณ ์๋ฃ
Explicit mapping | Elasticsearch Guide [7.13] | Elastic
You know more about your data than Elasticsearch can guess, so while dynamic mapping can be useful to get started, at some point you will want to specify your own explicit mappings. You can create field mappings when you create an index and add fields to a
www.elastic.co
fields | Elasticsearch Guide [7.13] | Elastic
Multi-fields do not change the original _source field.
www.elastic.co
'ElastciSearch' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Khaiii - ์นด์นด์ค ํํ์ ๋ถ์๊ธฐ( ์ค์น ๋ฐฉ๋ฒ, ์ ์ ๋ฑ ) (0) | 2021.05.16 |
---|---|
[ElasticSearch] nori analyzer ์ต์ ์ดํด๋ณด๊ธฐ (0) | 2021.04.01 |