elasticsearch 弹性搜索-更像是返回空结果的查询
我正在使用弹性搜索创建某种标记引擎。我正在插入文档,无法检索它。我复制该问题的步骤: 1) 创建索引:
elasticsearch 弹性搜索-更像是返回空结果的查询,
elasticsearch,lucene,morelikethis,
elasticsearch,Lucene,Morelikethis,我正在使用弹性搜索创建某种标记引擎。我正在插入文档,无法检索它。我复制该问题的步骤: 1) 创建索引: PUT index { "mappings": { "taggeable" : { "_all" : {"enabled" : false}, "properties" : { "id" : { "type" : "string", "index" : "no"
PUT index
{
"mappings": {
"taggeable" : {
"_all" : {"enabled" : false},
"properties" : {
"id" : {
"type" : "string",
"index" : "no"
},
"tags" : {
"type" : "text"
}
}
}
}
}
2) 插入文件:
POST index/taggeable
{
"id" : "1",
"tags" : "tag1 tag2"
}
3) 使用类似以下内容的查询:
GET index/_search
{
"query": {
"more_like_this" : {
"fields" : ["tags"],
"like" : ["tag1"],
"min_term_freq" : 1
}
}
}
但我收到了:
{
"_shards": {
"failed": 0,
"skipped": 0,
"successful": 5,
"total": 5
},
"hits": {
"hits": [],
"max_score": null,
"total": 0
},
"timed_out": false,
"took": 1
}
有人知道我做错了什么吗?我应该检索我插入的文档。您设置了参数 最小项频率 从中忽略术语的最小术语频率 输入文档。默认值为2 这是好的,否则它将默认为2。还有一个参数 最小文档频率 将忽略条款的最小文档频率 从输入文档。默认值为5 在您的情况下,如果您只有1个文档,那么这将被忽略,因此您需要添加更多文档,或者将参数
min\u doc\u freq
指定为1