課程
/云計算&大數(shù)據(jù)
/大數(shù)據(jù)
/ElasticSearch入門
請問這個是配置的問題,還是其他原因
2018-01-21
源自:ElasticSearch入門 6-5
正在回答
在試一試最好用chrome瀏覽器吆。把flag=1直接放進(jìn)playFun()函數(shù)里面,把flag=0直接放進(jìn)stopFun()函數(shù)里面,應(yīng)該就可以解決了
//?查詢接口 @GetMapping("/get/book/novel") public?ResponseEntity?get(@RequestParam(name?=?"id",?defaultValue?=?"")?String?id)?{ ????GetResponse?response?=?client.prepareGet(BOOK_INDEX,?BOOK_TYPE_NOVEL,?id).get(); ????if?(!response.isExists())?{ ????????return?new?ResponseEntity(HttpStatus.NOT_FOUND); ????} ????return?new?ResponseEntity(response.getSource(),?HttpStatus.OK); }
id存儲在 GetResponse response 中,而示例里面,返回的是 response.getSource() ,具體結(jié)構(gòu)可以自己debug看一下。
如果直接返回?GetResponse response 對象,那么得到的結(jié)果如下:
{ ????"fields":?{}, ????"id":?"1", ????"type":?"novel", ????"index":?"book", ????"source":?{ ????????"word_count":?5000, ????????"author":?"王五", ????????"title":?"超級菜譜", ????????"publish_date":?"2002-10-01" ????}, ????"version":?2, ????"exists":?true, ????"sourceAsMap":?{ ????????"word_count":?5000, ????????"author":?"王五", ????????"title":?"超級菜譜", ????????"publish_date":?"2002-10-01" ????}, ????"sourceEmpty":?false, ????"sourceAsBytesRef":?{ ????????"childResources":?[] ????}, ????"sourceAsBytes":?"eyJhdXRob3IiOiLnjovkupQiLCJ0aXRsZSI6Iui2hee6p+iPnOiwsSIsIndvcmRfY291bnQiOjUwMDAsInB1Ymxpc2hfZGF0ZSI6IjIwMDItMTAtMDEifQ==", ????"sourceInternal":?{ ????????"childResources":?[] ????}, ????"sourceAsString":?"{\"author\":\"王五\",\"title\":\"超級菜譜\",\"word_count\":5000,\"publish_date\":\"2002-10-01\"}", ????"fragment":?false }
舉報
ElasticSearch輕松入門,Spring Boot集成ES
1 回答query_string查詢是默認(rèn)到title字段里去查詢嗎?還是所有字段
1 回答請問在全文本查詢中指定字段和字段級別查詢有什么區(qū)別呢
3 回答查詢條件為字段長度
1 回答author字段不能模糊查詢而title可以模糊查詢?
2 回答關(guān)于語法查詢中-范圍查詢問題(如何查詢多個字段的范圍)
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2022-03-25
在試一試最好用chrome瀏覽器吆。把flag=1直接放進(jìn)playFun()函數(shù)里面,把flag=0直接放進(jìn)stopFun()函數(shù)里面,應(yīng)該就可以解決了
2018-03-06
id存儲在 GetResponse response 中,而示例里面,返回的是 response.getSource() ,具體結(jié)構(gòu)可以自己debug看一下。
如果直接返回?GetResponse response 對象,那么得到的結(jié)果如下: