都是相同的查询语句,使用JavaAPI的方式发送查询请求得到的结果与使用Kibana发送查询请求得到的数据格式不同。
都是用下面的查询语句
使用JavaAPI方式得到的结果
																																
															
														都是用下面的查询语句
使用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
}{
  "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>"
          ]
        }
      }
    ]
  }
}

 
	
1 个回复
Sakura0408
赞同来自: