다음 쿼리를 사용하여 아래의 데이터에 대한 탄성 검색을 사용하여 용어 집계를 수행하려고하면 출력 결과가 토큰으로 분리됩니다 (아래 출력 참조). 그래서 os_name을 multi_field로 매핑하려고 시도했지만 지금은 쿼리 할 수 없습니다. 토큰없이 색인을 가질 수 있습니까? "페도라 코어"와 같은ElasticSearch 용어 집계
검색어 :
GET /temp/example/_search
{
"size": 0,
"aggs": {
"OS": {
"terms": {
"field": "os_name"
}
}
}
}
데이터 :
...
{
"_index": "temp",
"_type": "example",
"_id": "3",
"_score": 1,
"_source": {
"title": "system3",
"os_name": "Fedora Core",
"os_version": 18
}
},
{
"_index": "temp",
"_type": "example",
"_id": "1",
"_score": 1,
"_source": {
"title": "system1",
"os_name": "Fedora Core",
"os_version": 20
}
},
{
"_index": "temp",
"_type": "example",
"_id": "2",
"_score": 1,
"_source": {
"title": "backup",
"os_name": "Yellow Dog",
"os_version": 6
}
}
...
출력 :
...
{
"key": "core",
"doc_count": 2
},
{
"key": "fedora",
"doc_count": 2
},
{
"key": "dog",
"doc_count": 1
},
{
"key": "yellow",
"doc_count": 1
}
...
MAPP 보내고 : 일하는 것이
PUT /temp
{
"mappings": {
"example": {
"properties": {
"os_name": {
"type": "string"
},
"os_version": {
"type": "long"
},
"title": {
"type": "string"
}
}
}
}
}
너무 당신의 매핑을 게시하시기 바랍니다 . – Thorsten
안녕하세요 @ 토르스틴, 매핑을 추가했습니다. 감사. – codeBarer