设置参数 `node.name` 可以自定义 Elasticsearch 节点的名字。 此条 Tips 由 medcl 贡献。

使用JavaAPI发送查询得到的结果与使用Kibana发送查询得到的数据格式不同

Elasticsearch | 作者 Sakura0408 | 发布于2019年12月14日 | 阅读数:1821

都是相同的查询语句,使用JavaAPI的方式发送查询请求得到的结果与使用Kibana发送查询请求得到的数据格式不同。
都是用下面的查询语句
E24I5K`HZKH(7Z2QOBL3X8T.png

使用JavaAPI方式得到的结果
{
"took":{
"hours":0,
"nanos":13000000,
"minutes":0,
"daysFrac":0.00000015046296296296297,
"microsFrac":13000,
"millisFrac":13,
"seconds":0,
"days":0,
"micros":13000,
"hoursFrac":0.000003611111111111111,
"secondsFrac":0.013,
"stringRep":"13ms",
"millis":13,
"minutesFrac":0.00021666666666666666
},
"timedOut":false,
"shardFailures":[

],
"successfulShards":10,
"totalShards":10,
"failedShards":0,
"skippedShards":0,
"hits":{
"hits":[
{
"sourceAsMap":{
"creator":17,
"gmtModified":1573045785812,
"description":"你猜啊。",
"likeCount":0,
"id":131,
"tag":"SpringBoot",
"viewCount":5,
"gmtCreate":1573045785812,
"title":"如何快速学习Spring Boot?",
"commentCount":1
},
"seqNo":-2,
"primaryTerm":0,
"index":"question",
"type":"_doc",
"sortValues":[

],
"sourceAsString":"{"creator":17,"gmtModified":1573045785812,"description":"你猜啊。","likeCount":0,"id":131,"tag":"SpringBoot","viewCount":5,"gmtCreate":1573045785812,"title":"如何快速学习Spring Boot?","commentCount":1}",
"version":-1,
"score":1.4454324,
"fragment":false,
"highlightFields":{
"tag":{
"fragment":true,
"name":"tag",
"fragments":[
{
"fragment":true
}
]
}
},
"matchedQueries":[

],
"id":"131",
"fields":{

},
"sourceRef":{
"fragment":true
},
"rawSortValues":[

]
}],
"fragment":true,
"totalHits":{
"value":1,
"relation":"EQUAL_TO"
},
"maxScore":1.4454324
},
"fragment":false,
"profileResults":{

},
"clusters":{
"fragment":true,
"total":0,
"skipped":0,
"successful":0
},
"numReducePhases":1
}
使用Kibana得到的结果
{
"took" : 19,
"timed_out" : false,
"_shards" : {
"total" : 10,
"successful" : 10,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.4454324,
"hits" : [
{
"_index" : "question",
"_type" : "_doc",
"_id" : "131",
"_score" : 1.4454324,
"_source" : {
"creator" : 17,
"gmtModified" : 1573045785812,
"description" : "你猜啊。",
"likeCount" : 0,
"id" : 131,
"tag" : "SpringBoot",
"viewCount" : 5,
"gmtCreate" : 1573045785812,
"title" : "如何快速学习Spring Boot?",
"commentCount" : 1
},
"highlight" : {
"tag" : [
"<em>SpringBoot</em>"
]
}
}
]
}
}
why?
已邀请:

Sakura0408

赞同来自:

是我搞错了。。。此贴终结

要回复问题请先登录注册