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