[Elastic Search] ์ฌ๋ฌ ๊ฐ์ Shard๋ก ์ธํด ๊ฒ์ ๊ฒฐ๊ณผ(Score)๊ฐ ์ ํํ์ง ์์ ๋
์ ์ ์กฐ๊ฑด
fruit์ด๋ผ๋ index์ name์ด๋ผ๋ ํ๋๊ฐ ์๊ณ ๋ค์๊ณผ ๊ฐ์ด ์ฌ๋ฌ ๊ฐ์ document๋ค์ด ์๋ค๊ณ ๊ฐ์ ํ์.
{"index":{}}
{"room_name": "๋ง๊ณ "}
{"index":{}}
{"room_name": "๋ง๊ณ ์คํด"}
{"index":{}}
{"room_name": "๋ง๊ณ ๋ง๊ณ ๋ง๊ณ "}
{"index":{}}
{"room_name": "๋ง๊ณ ๊ฐ์ฌฌ์์ฌฌ์"}
{"index":{}}
{"room_name": "๋ง๊ณ ํ๋๋ฃน"}
{"index":{}}
{"room_name": "๊น๋ง๊ณ "}
{"index":{}}
{"room_name": "์ธ์์์ ์ ์ผ ๋ง์๋๊ฑด ๋ง๊ณ ์ง"}
์ค๋์ ๊ฐฏ์๋ 3๊ฐ
๊ฒ์ ์๊ณ ๋ฆฌ์ฆ์ BM25๋ฅผ ์ฌ์ฉ, tokenizer๋ ngram tokenizer(min:1) ์ฌ์ฉ.
๋ฌธ์
๋ค์๊ณผ ๊ฐ์ Query๋ฅผ ๋ ๋ฆฌ๋ฉด ์ฐ๋ฆฌ๋ "๋ง๊ณ "๊ฐ ๊ฐ์ฅ 1์์๋ก ์ถ๋ ฅ๋ ๊ฒ์ด๋ผ๊ณ ์์๋๋๋ฐ
POST /_search
{
"query": {
"match": {
"room_name": "๋ง๊ณ "
}
}
}
{
"took": 16,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 7,
"relation": "eq"
},
"max_score": 0.2876821,
"hits": [
{
"_index": "public_chat",
"_type": "_doc",
"_id": "fNTe0GwBME3K7rKzaiF0",
"_score": 0.2876821,
"_source": {
"room_name": "๋ง๊ณ ๊ฐ์ฌฌ์์ฌฌ์"
}
},
{
"_index": "public_chat",
"_type": "_doc",
"_id": "edTe0GwBME3K7rKzaiF0",
"_score": 0.11770796,
"_source": {
"room_name": "๋ง๊ณ "
}
},
{
"_index": "public_chat",
"_type": "_doc",
"_id": "e9Te0GwBME3K7rKzaiF0",
"_score": 0.101606146,
"_source": {
"room_name": "๋ง๊ณ ๋ง๊ณ ๋ง๊ณ "
}
},
{
"_index": "public_chat",
"_type": "_doc",
"_id": "ftTe0GwBME3K7rKzaiF0",
"_score": 0.1014327,
"_source": {
"room_name": "๊น๋ง๊ณ "
}
},
{
"_index": "public_chat",
"_type": "_doc",
"_id": "etTe0GwBME3K7rKzaiF0",
"_score": 0.08564364,
"_source": {
"room_name": "๋ง๊ณ ์คํด"
}
},
{
"_index": "public_chat",
"_type": "_doc",
"_id": "fdTe0GwBME3K7rKzaiF0",
"_score": 0.07169379,
"_source": {
"room_name": "๋ง๊ณ ํ๋๋ฃน"
}
},
{
"_index": "public_chat",
"_type": "_doc",
"_id": "f9Te0GwBME3K7rKzaiF0",
"_score": 0.049237844,
"_source": {
"room_name": "์ธ์์์ ์ ์ผ ๋ง์๋๊ฑด ๋ง๊ณ ์ง"
}
}
]
}
}
์ฐ๋ฆฌ์ ์์๊ณผ๋ ๋ฐ๋๋ก ๋ค๋ฅธ ์์๊ฐ ์ถ๋ ฅ๋์๋ค.
ํด๊ฒฐ
์์ ๊ฐ์ด ์ฐ๋ฆฌ์ ์์๊ณผ ๋ฒ์ด๋ ๊ฒฐ๊ณผ๊ฐ ์ถ๋ ฅ๋๋ ์ด์ ๋ ๊ฐ ์ค๋ ๋ณ๋ก ์ค์ฝ์ด๋ง์ ํ ํ ๊ฒฐ๊ณผ๋ฅผ ์ทจํฉํ๊ธฐ ๋๋ฌธ์ด๋ค.
๊ทธ๋์, ์ฐ๋ฆฌ๋ ์ ์ฒด ์ค๋ ๊ฒ์ ๊ฒฐ๊ณผ๋ฅผ ์ทจํฉํ ํ ์ค์ฝ์ด๋ง ํ ํ์๊ฐ ์๋ค.
POST /_search?search_type=dfs_query_then_fetch
{
"query": {
"match": {
"room_name": "๋ง๊ณ "
}
}
}
{
"took": 17,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 7,
"relation": "eq"
},
"max_score": 0.10460657,
"hits": [
{
"_index": "public_chat",
"_type": "_doc",
"_id": "edTe0GwBME3K7rKzaiF0",
"_score": 0.10460657,
"_source": {
"room_name": "๋ง๊ณ "
}
},
{
"_index": "public_chat",
"_type": "_doc",
"_id": "e9Te0GwBME3K7rKzaiF0",
"_score": 0.092210956,
"_source": {
"room_name": "๋ง๊ณ ๋ง๊ณ ๋ง๊ณ "
}
},
{
"_index": "public_chat",
"_type": "_doc",
"_id": "ftTe0GwBME3K7rKzaiF0",
"_score": 0.091497645,
"_source": {
"room_name": "๊น๋ง๊ณ "
}
},
{
"_index": "public_chat",
"_type": "_doc",
"_id": "etTe0GwBME3K7rKzaiF0",
"_score": 0.0783982,
"_source": {
"room_name": "๋ง๊ณ ์คํด"
}
},
{
"_index": "public_chat",
"_type": "_doc",
"_id": "fdTe0GwBME3K7rKzaiF0",
"_score": 0.066497825,
"_source": {
"room_name": "๋ง๊ณ ํ๋๋ฃน"
}
},
{
"_index": "public_chat",
"_type": "_doc",
"_id": "fNTe0GwBME3K7rKzaiF0",
"_score": 0.047680173,
"_source": {
"room_name": "๋ง๊ณ ๊ฐ์ฌฌ์์ฌฌ์"
}
},
{
"_index": "public_chat",
"_type": "_doc",
"_id": "f9Te0GwBME3K7rKzaiF0",
"_score": 0.04666439,
"_source": {
"room_name": "์ธ์์์ ์ ์ผ ๋ง์๋๊ฑด ๋ง๊ณ ์ง"
}
}
]
}
}
์์ ๊ฐ์ด serach_type์ dfs_query_then_fetch ์ต์ ์ ์ฃผ๋ฉด ํด๊ฒฐ๋๋ค.
๋จ! ์ ํํ ๊ฒฐ๊ณผ๋ฅผ ์ป์ ์ ์์ง๋ง ์ฑ๋ฅ์ด ๋๋ฆฌ๋ฏ๋ก ์์ฉ ์๋น์ค์์๋ ๊ถ์ฅ๋์ง ์๋๋ค.
์ด์ฐจํผ, document์ ์ซ์๊ฐ ๋ง์์ง๋ฉด ์ด ์ต์ ์ ์ฌ์ฉํ์ง ์์๋ ์ฐ๋ฆฌ๊ฐ ์๋ํ ์ ํ๋๋ก ์๋ ดํ๋ค.
์ถ์ฒ
https://stackoverflow.com/questions/47740665/inconsistent-scoring-in-elasticsearch
http://jinuland.blogspot.com/2015/10/elasticsearch-search-type.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#request-body-search-search-type
'Server > Elastic Search' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๋๊ธ
์ด ๊ธ ๊ณต์ ํ๊ธฐ
-
๊ตฌ๋
ํ๊ธฐ
๊ตฌ๋ ํ๊ธฐ
-
์นด์นด์คํก
์นด์นด์คํก
-
๋ผ์ธ
๋ผ์ธ
-
ํธ์ํฐ
ํธ์ํฐ
-
Facebook
Facebook
-
์นด์นด์ค์คํ ๋ฆฌ
์นด์นด์ค์คํ ๋ฆฌ
-
๋ฐด๋
๋ฐด๋
-
๋ค์ด๋ฒ ๋ธ๋ก๊ทธ
๋ค์ด๋ฒ ๋ธ๋ก๊ทธ
-
Pocket
Pocket
-
Evernote
Evernote
๋ค๋ฅธ ๊ธ
-
[Elastic Search] ์ธ๋ถ์์ Elastic Search API ์ฌ์ฉํ๊ธฐ (Production mode)
[Elastic Search] ์ธ๋ถ์์ Elastic Search API ์ฌ์ฉํ๊ธฐ (Production mode)
2019.08.20 -
[Elastic Search] Linux(CentOS) ์๋ผ์คํฑ ์์น 7 ๋ฒ์ ๋ ์ค์น(elastic search 7.x install)
[Elastic Search] Linux(CentOS) ์๋ผ์คํฑ ์์น 7 ๋ฒ์ ๋ ์ค์น(elastic search 7.x install)
2019.08.20