基本查询
基本查詢
ElasticsearchRepository提供了一些基本的查詢方法:
我們來試試查詢所有:
@Test public void testQuery(){Optional<Item> optional = this.itemRepository.findById(1l);System.out.println(optional.get()); }@Test public void testFind(){// 查詢?nèi)?#xff0c;并按照價格降序排序Iterable<Item> items = this.itemRepository.findAll(Sort.by(Sort.Direction.DESC, "price"));items.forEach(item-> System.out.println(item)); }?
超強干貨來襲 云風(fēng)專訪:近40年碼齡,通宵達旦的技術(shù)人生總結(jié)