随笔分类 - Java.ElasticsSearch
摘要:【创建数据资产索引】 curl -H "Content-Type: application/json" -XPUT 'localhost:9200/asset' -d' { "mappings" : { "properties" : { "sn" : { "type" : "integer" },
阅读全文
摘要:【Mapping的用处】 mapping会把JSON文档文档映射成Lucene所需要的扁平格式一个mapping属于一个索引的type每个文档都属于一个Type一个type又一个mapping定义7.0开始,不需要在mapping定义中指定type信息,因为默认每个索引只有一个type叫"_doc"
阅读全文
摘要:下文分四部分: 一.清除旧有数据 二.增添测试数据 三.设置对name进行优化 四.将查询结果按name升序输出 一.清除旧有数据 #删除所有旧有数据并删除索引结构 命令: curl -u elastic:123456 -XDELETE 'localhost:9200/apple' 返回结果: {"
阅读全文
摘要:【添加测试数据】 curl -u elastic:123456 -H "Content-Type: application/json" -XPUT 'localhost:9200/ibm/emp/1?pretty' -d' {"name":"andy","age":"25","resume":"gr
阅读全文
摘要:注:下文中-u elastic:123456是为了适应本机设上了密码的ES,如读者的没有设置,那么请忽略这部分内容。 【查看索引信息】 命令: curl -u elastic:123456 -XGET 'localhost:9200/_cat/indices?v' 反馈: health status
阅读全文
摘要:命令: curl -u elastic:123456 -XGET 'localhost:9200/_cat/indices?v' -u 后跟上用户名+“:”+密码,后面就是实际的访问指令。 示例: [hy@localhost ~]$ curl -u elastic:123456 -XGET 'loc
阅读全文
摘要:Lucene MySQL Index database Type table Document row、record Field column Hit result END
阅读全文
摘要:【192.168.32.128的用户密码】 elastic/123456 【192.168.32.128上ES默认返回的内容】 { "name" : "node-1", "cluster_name" : "liangshan", "cluster_uuid" : "h6AscLaBS0qyOKdfq
阅读全文
摘要:【程序】 import org.apache.catalina.authenticator.BasicAuthenticator; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordC
阅读全文
摘要:【本文涉及ES版本】 7.11.1 【elasticsearch.yml中设置】 增加以下两项设置: xpack.security.enabled: truexpack.security.transport.ssl.enabled: true 【启动es后使用elasticsearch-setup-
阅读全文
摘要:【请求网址】 http://192.168.32.130:9200/moft/emp/_search?pretty 【返回的json】 { "took" : 39, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "
阅读全文
摘要:【代码】 import com.alibaba.fastjson.JSONObject; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.sprin
阅读全文
摘要:【依赖】 一般来说,SpringBoot程序自带RestTemplate,不需要额外引用。 如果是Maven程序,可以载入以下引用: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-st
阅读全文
摘要:【前篇】 https://www.cnblogs.com/heyang78/p/15929695.html 请参阅前篇再看此篇。 【实现原理】 利用单播列表来发现其它节点,细节请参阅Elasticsearch In Action P242页。 【目标】 虚拟机CentOs1:192.168.245.
阅读全文
摘要:【前篇】 【CentOs7/Elasticsearch7.11.0】ES单机单实例安装手顺 【CentOs7/Elasticsearch7.11.0】ES单机双实例(一主一从)安装手顺 请在了解了上述两篇再来尝试此篇,还有一些系统设置,jvm.options设置也在上面两篇表述。 另外为了简便起见,
阅读全文
摘要:【前奏】 在配置单机双实例之前,请先熟悉单机单实例配置:https://www.cnblogs.com/heyang78/p/15922514.html ,关于系统配置的部分本文不再赘述。 【目标】 在192.168.32.130上配置一主一从两个节点。 主节点在用户hy名下,从节点在用户ufo名下
阅读全文
摘要:【介绍页】 https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-11-1 【下载地址】 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch
阅读全文
摘要:ES装好后,输入curl localhost:9200无错,从远程访问也OK,但创建文档时出错...... [hy@localhost ~]$ curl -H "Content-Type: application/json" -XPUT 'localhost:9200/moft/emp/1?pret
阅读全文
摘要:【使用ES版本】 elasticsearch-7.11.0-linux-x86_64 【列出现有索引】 命令 curl -XGET 'localhost:9200/_cat/indices?v' 执行情况: [ufo@localhost ~]$ curl -XGET 'localhost:9200/
阅读全文
摘要:【出错原因】 之前启动的ES没有正常退出,导致节点锁定 【解决方案】 找出之前ES进程,强行kill掉 【具体步骤】 [ufo@localhost bin]$ ps aux|grep elastic ufo 6609 2.7 13.6 2755980 136268 pts/1 Sl+ 20:07 1
阅读全文