ES JS Client 发生了一些非常奇怪的事情。client.search() 方法似乎工作正常,索引和搜索数据工作正常,但如果重新启动 elasticsearch.bat 则客户端停止工作。我的意思是,client.search 用相同的代码给了我 0 次点击。但是,如果我使用任何其他客户端进行搜索,我会在索引中找到所有可用的文档。
这是使用 GET http://localhost:9200/yojuego/_mappings的映射:
{
"yojuego": {
"mappings": {
"user": {
"properties": {
"password": {
"type": "string"
}
"type": {
"type": "string"
}
"userid": {
"type": "string"
}
}
}
}
}
}
以下是我从 NodeJS 中查找信息的方式:
this.client.search({
index: "yojuego",
type: "user",
body: {
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{ "term": { "userid": criteria } },
{ "term": { "type": "yojuego" } }
]
}
}
}
}
}
}, (error, response, status) => {
if (error) {
//I have no error
}
else {
//Here is where I have 0 hits in response.hits.hits
}
});
相关帖子:
我收到了很多答案,一开始都可以正常工作,但后来都停止了工作
我正在使用的框架:
- 弹性搜索 2.4.0
- 节点.js 6.3.0
- 弹性搜索.js 11.0.1
我是如何安装 ElasticSearch 的?只需从 ES 网站下载,解压缩并运行 elasticsearch.bat(我在 Windows 7 上运行)
同样,问题是 ES 服务重置后 ES 停止工作。当然,我很确定我做错了什么,但我无法意识到 ES Service Search 突然停止工作的位置和原因。
当我说“停止工作”时,我是说来自 ES js 客户端的搜索方法检索 0 匹配与昨天使用的相同查询。
我希望我解释清楚。谢谢。
PD:
这是我初始化 es 客户端的方式:
var es = require('elasticsearch');
var client = new es.Client({
host: 'http://localhost:9200',
log: 'info'
});