我正在关注https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html,但无法获得预期的结果。哪个部分我做错了?
文件格式为:
PUT integrity
{
"mappings": {
"body": {
"properties": {
"label": {
"type": "keyword",
"index": "not_analyzed",
"store": true
},
"body": {
"type": "text",
"store": true
}
}
}
}
}
答案 0 :(得分:0)
_all
字段的默认映射不包括存储术语向量:
"_all": {
"full_name": "_all",
"mapping": {
"_all": {
"enabled": true,
"store": false,
"store_term_vectors": false,
"store_term_vector_offsets": false,
"store_term_vector_positions": false,
"store_term_vector_payloads": false,
"norms": true,
"analyzer": "default",
"similarity": "BM25"
}
}
}
而且,似乎_all
字段有点特殊而且Elasticsearch没有compute the vectors on the fly。
_all
的唯一选择是在其上启用术语向量:
PUT integrity
{
"mappings": {
"body": {
"_all": {
"term_vector": "with_positions_offsets"
},
"properties": {
"label": {
"type": "keyword",
"index": "not_analyzed",
"store": true
},
"body": {
"type": "text",
"store": true
}
}
}
}
}