parent
fe7cf8b63f
commit
609f6e7516
|
@ -19,8 +19,7 @@ import io.minio.GetObjectArgs;
|
||||||
import io.minio.MinioClient;
|
import io.minio.MinioClient;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.elasticsearch.search.SearchHit;
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
@ -204,6 +203,32 @@ public class DemoController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("demo222")
|
||||||
|
public Result<?> demo222() {
|
||||||
|
|
||||||
|
|
||||||
|
SearchHit[] hits = productEsMapper.search(new LambdaEsQueryWrapper<ProductDocument>()
|
||||||
|
.eq(ProductDocument::getPrice, 8999)).getHits().getHits();
|
||||||
|
for (SearchHit hit : hits) {
|
||||||
|
|
||||||
|
System.out.println(hit.getSourceAsMap().get("price"));
|
||||||
|
System.out.println(hit.getSourceAsMap().get("name"));
|
||||||
|
System.out.println(hit.getSourceAsMap().get("description"));
|
||||||
|
System.out.println(hit.getSourceAsMap().get("category"));
|
||||||
|
System.out.println(hit.getSourceAsMap().get("stock"));
|
||||||
|
}
|
||||||
|
// ArrayList<Integer> integers = new ArrayList<>();
|
||||||
|
// integers.add(1);
|
||||||
|
// integers.forEach(i -> System.out.println("i = " + i));
|
||||||
|
|
||||||
|
|
||||||
|
// System.out.println(productEsMapper.search(new LambdaEsQueryWrapper<ProductDocument>()
|
||||||
|
// .eq(ProductDocument::getPrice, 8999)).getHits().getHits());
|
||||||
|
|
||||||
|
return Result.success("demo222");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("demo333")
|
@GetMapping("demo333")
|
||||||
public Result<?> demo333() {
|
public Result<?> demo333() {
|
||||||
// 执行ES查询并格式化打印结果
|
// 执行ES查询并格式化打印结果
|
||||||
|
|
Loading…
Reference in New Issue