摘要: @Configuration public class ElasticSearchClient { @Value("${ElasticSearch.Hosts}") private String hosts; @Value("${ElasticSearch.UserName}") private S 阅读全文
posted @ 2021-02-02 15:23 lovelifest 阅读(1550) 评论(0) 推荐(0) 编辑
摘要: 在一个不存在的索引上添加ignore_unavailable=true,可以忽略访问不存在的索引“dddd”导致的报错 POST /dddd/_search?ignore_unavailable=true { "profile": true, "query": { "match_all": {} } 阅读全文
posted @ 2021-02-01 20:38 lovelifest 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 原理 产生线程安全问题的根源在于多线程之间的数据共享。如果没有数据共享,就没有多线程并发安全问题。ThreadLocal就是用来避免多线程数据共享从而避免多线程并发安全问题。它为每个线程保留一个对象的副本,避免了多线程数据共享。每个线程作用的对象都是线程私有的一个对象拷贝。一个线程的对象副本无法被其 阅读全文
posted @ 2021-02-01 16:49 lovelifest 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 1.1、依赖管理 父项目做依赖管理 依赖管理 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.4.RELEASE 阅读全文
posted @ 2021-01-29 15:55 lovelifest 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Thread.interrupted()和Thread.isInterrupted()和Thread.interrupt()异同 共性: 调用线程的interrupted()和isInterrupted()方法,只是接受了别的线程传过来的信号,给线程做了中断状态的标志,它们本身不能抛出Interru 阅读全文
posted @ 2021-01-28 18:15 lovelifest 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 线程的五种状态: 新建(NEW):新创建了一个线程对象。 可运行(RUNNABLE):线程对象创建后,其他线程(比如main线程)调用了该对象的start()方法。该状态的线程位于可运行线程池中,等待被线程调度选中,获取cpu 的使用权 。 运行(RUNNING):可运行状态(runnable)的线 阅读全文
posted @ 2021-01-28 18:10 lovelifest 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 基本查询,q表示关键字,df为不指定字段的默认字段,sort时间排序,from和size表示分页和每页大小,timeout为超时时间 GET /movies/_search?q=2012&df=title&sort=year:desc&from=0&size=10&timeout=1s 带profi 阅读全文
posted @ 2021-01-25 20:46 lovelifest 阅读(58) 评论(0) 推荐(0) 编辑
摘要: IK分词器 各平台配置IK分词器 elasticsearch-analysis-ik releases:https://github.com/medcl/elasticsearch-analysis-ik/releases Windows:在elasticsearch安装目录中的plugins目录内 阅读全文
posted @ 2021-01-25 15:31 lovelifest 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 基本curd post请求 post请求不带id,会自动生成id POST st_test_2021_01_25/_doc { "user" : "zhangsan", "post_data" : "2021-01-25", "message" : "zhangsan try to create" 阅读全文
posted @ 2021-01-25 15:03 lovelifest 阅读(48) 评论(0) 推荐(0) 编辑