elasticsearch - ElasticSearch - query_shard_exception | 未找到 [timestamp] 的映射,以便通过 kibana 开发工具对 on-Works 进行排序,但通过 API 出现 400 错误
问题描述
在查询弹性搜索时面临一个奇怪的问题,其中查询在通过 Kibana 开发工具运行时给出了正确的响应,但通过 Rest API 得到了 400 错误,找不到映射。以下是详细信息。通过 Kibana 开发工具查询:
GET 诊断/_search?pretty=true&q=OTA4MjYxODM3NQ&size=6&sort=timestamp:desc
获得对上述查询的响应:
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 22,
"max_score": null,
"hits": [
{
.......
}
]
}
但是当我通过下面的 Rest API 达到同样的效果时,情况如下: API - http://IP:9200/diagnostics/_search?pretty=true&q=OTA4MjYxODM3NQ&size=6&sort=timestamp:desc
回复 :
{
"error": {
"root_cause": [
{
"type": "query_shard_exception",
"reason": "No mapping found for [timestamp] in order to sort on",
"index_uuid": "JYOLtQ_URBGKnhxUWzD3dA",
"index": "diagnostics"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "diagnostics",
"node": "kisW84q1SbKEz7KQiOtY7Q",
"reason": {
"type": "query_shard_exception",
"reason": "No mapping found for [timestamp] in order to sort on",
"index_uuid": "JYOLtQ_URBGKnhxUWzD3dA",
"index": "diagnostics"
}
}
]
},
"status": 400
}
请帮助我,因为我在调用 API 时通过代码发现这很奇怪,它失败了,我坚持理解其根本原因。
获取诊断详细信息
http://IP(A):9200/diagnostics
{
"diagnostics": {
"aliases": {},
"mappings": {},
"settings": {
"index": {
"creation_date": "1613465495276",
"number_of_shards": "5",
"number_of_replicas": "0",
"uuid": "JYOLtQ_URBGKnhxUWzD3dA",
"version": {
"created": "5050199"
},
"provided_name": "diagnostics"
}
}
}
}
通过在 IP(A):5601- 上运行的 Kibana 开发工具
GET diagnostics
{
"diagnostics": {
"aliases": {},
"mappings": {
"results": {
"properties": {
details are present here....
}
"number_of_shards": "5",
"provided_name": "diagnostics",
"creation_date": "1545374854111",
"number_of_replicas": "0",
"uuid": "CB7Vci8MTNiW2F85_S4z4Q",
"version": {
"created": "5050199"
}
}
}
}
}
解决方案
几乎可以肯定,您的 Kibana 指向的是另一个正在运行的 Elasticsearch 实例。
确保设置下的 kibana.yml 文件中的 IPelasticsearch.hosts
与IP(A)
.
推荐阅读
- sql - ratio calculated in Cloudera
- python - Inheritance issue creating objects
- php - PHP Send notification to remote phone
- python - Python:ValueError:使用序列设置数组元素
- toad - 将输出结果递减的 Toad sql 查询合并到一个列表中
- python - TKinter GUI 使用 root.after 冻结
- java - 将二维数组转换为一维数组时如何删除不必要的 int 分配?
- vb.net - 在 VB.Net 中使用 Lambda(或 LINQ)将集合拆分为 n 个部分
- c# - 在razor的表单中添加参数
- python-2.7 - python sqlite3 .executemany() 与命名占位符?