[elasticsearch] copy_to 용법
일래스틱서치에서 copy_to 용법 관련해서, (https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-core-types.html#copy-to)
어떻게 사용할까(용법) 확인해봤더니
중복되지 않을 정보를 잘 활용하여 검색하게 할 수 있다.
성(last name)과 이름(first name)을 저장하지만, 성과 이름 둘 다(full name) 검색될 수 있도록 할 수 있다.
또는 이름(name)과 별명(alias)을 따로 저장하지만, 둘 다 추천될 수 있게 할 수 있다.
예제1)
{
"name": {"type": "string", "copy_to":["suggest"]},
"alias": {"type": "string", "copy_to":["suggest"]},
"suggest": {
"type": "complection",
"payloads": true,
"index_analyzer": "simple",
"search_analyzer": "simple"
}
}
예제 2)
{
"people": {
"properties": {
"last_name": {
"type": "string",
"copy_to": "full_name"
},
"first_name": {
"type": "string",
"copy_to": "full_name"
},
"state": {
"type": "string"
},
"city": {
"type": "string"
},
"full_name": {
"type": "string"
}
}
}
}