GET /_index_template/content_erp_nlp_help
DELETE /_index_template/content_erp_nlp_help
PUT /_index_template/content_erp_nlp_help
{
"index_patterns": ["content_erp*"],
"priority": 100,
"template": {
"settings": {
"analysis": {
"analyzer": {
"my_ik_analyzer": {
"type": "ik_smart"
}
}
},
"number_of_shards": 1,
"number_of_replicas": 2
},
"mappings": {
"properties": {
"id": {"type": "long"},
"content": {"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_smart"},
"content_vector": {"type": "dense_vector","similarity": "cosine","index": true,"dims": 768,"element_type": "float","index_options": {"type": "hnsw","m": 16,"ef_construction": 128}},
"content_answer": {"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_smart"},
"title": {"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_smart"},
"param": {"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_smart"},
"type": {"type": "keyword"},
"questionId": {"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_smart"},
"createTime": {"type": "date"},
"updateTime": {"type": "date"},
"hitCount": {"type": "integer"},
"answerPattern": {"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_smart"},
"nearQuestionVOList": {"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_smart"},
"questionEnclosureVOList": {"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_smart"},
"questionRelationVOList": {"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_smart"},
"rmsRoutingAnswerVos": {"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_smart"}
}
}
}
}
其他说明:
在Elasticsearch中,_score
字段代表的是文档的相关性得分。这个得分是在执行搜索查询时根据文档与查询条件的匹配程度计算出来的。它主要用于排序搜索结果,得分越高通常意味着文档与搜索条件更相关。
当你执行一个搜索操作并且启用了评分机制(默认情况下评分是启用的),Elasticsearch会为每个匹配的文档计算一个 _score
值。这个值是由查询类型决定的,并且可以由多种因素影响,比如关键词出现的位置、频率、倒排索引中的文档频率等等。
有时候,你会看到所有的 _score
值都是 1
或者所有的文档都有相同的 _score
值,这通常是因为使用了不带任何评分机制的查询或者所有文档都被认为具有相同的相关性。例如,如果你使用 match_all
查询,没有特定的筛选条件,那么所有索引中的文档都会被认为是相关的,并且会被赋予相同的分数,可能是 1
或其他某个数值。
如果你不需要这些评分信息,可以在搜索请求中关闭评分功能以提高性能,通过设置 search_type
参数为 dfs_query_then_fetch
或者在查询请求中添加 _source
参数来排除 _score
。
总之,_score
的存在是为了帮助你根据相关性对搜索结果进行排序,而它的具体值取决于你的查询语句以及文档的内容。如果你发现 _score
对你的应用场景来说没有用处,可以选择忽略它或者在查询时明确排除它。