![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ES知识分享
文章平均质量分 59
城畜猿
这个作者很懒,什么都没留下…
展开
-
java操作需要用户名密码验证的elasticsearch
给大家一个小例子,按照这样写,添加上用户名和密码就可以了//es 有用户名和密码RestHighLevelClient esClient = null;//初始化ES操作客户端final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCred.原创 2021-08-20 15:55:48 · 1212 阅读 · 0 评论 -
elastic search添加密码验证并且使用postman访问带密码的es
1 使用ES自带的XPACK开启密码校验在es7.0版本以后(之前的版本没怎么用过,不太清楚)安装包默认自带了xpack功能,所以只需要在es包下的config目录修改一下es的默认配置文件elasticsearch.yml即可,在elasticsearch.yml中追加写入以下参数xpack.security.enabled: true## 加密方式xpack.license.self_generated.type: basicxpack.security.transport.ssl.e原创 2021-08-20 15:51:28 · 1054 阅读 · 0 评论 -
解决elasticsearch配置network.host: 0.0.0.0导致elasticsearch服务启动不成功的问题
解决elasticsearch配置network.host: 0.0.0.0导致elasticsearch服务启动不成功的问题一、问题概述本人在本地的虚拟机linux上安装的elasticsearch。当修改 elasticsearch.yml 文件的 network.host: 0.0.0.0 时,引起了一系列异常,导致服务无法成功启动。network.host: 0.0.0.01引起的问题:elasticsearch服务进程启动一会之后,通过jps命令查看到进程关闭,命令行不提示错误。.转载 2021-08-18 19:48:11 · 1906 阅读 · 0 评论 -
使用Java Api 查询ElasticSearch 索引 每个字段的个数
import com.alibaba.fastjson.JSONObject;import org.apache.http.HttpHost;import org.elasticsearch.action.search.SearchRequest;import org.elasticsearch.action.search.SearchResponse;import org.elasticsearch.client.RequestOptions;import org.elasticsearch..原创 2021-08-18 16:06:01 · 473 阅读 · 0 评论 -
使用Java Api 查询ElasticSearch 索引 统计个数
统计索引中某个字段的个数public class ESTest_Doc_Query { public static void main(String[] args) throws Exception { //创建ES客户端 RestHighLevelClient esClient = new RestHighLevelClient( RestClient.builder(new HttpHost("localhost",9200,"...原创 2021-08-17 15:53:14 · 1479 阅读 · 0 评论 -
使用Java Api 查询ElasticSearch 索引 分组查询
public class ESTest_Doc_Query { public static void main(String[] args) throws Exception { //创建ES客户端 RestHighLevelClient esClient = new RestHighLevelClient( RestClient.builder(new HttpHost("localhost",9200,"http")) ...原创 2021-08-16 20:41:29 · 302 阅读 · 0 评论 -
使用Java Api 查询ElasticSearch 索引 聚合查询
public class ESTest_Doc_Query { public static void main(String[] args) throws Exception { //创建ES客户端 RestHighLevelClient esClient = new RestHighLevelClient( RestClient.builder(new HttpHost("localhost",9200,"http")) ...原创 2021-08-16 20:34:29 · 302 阅读 · 0 评论 -
使用Java Api 查询ElasticSearch(ES) 索引 高亮查询
public class ESTest_Doc_Query { public static void main(String[] args) throws Exception { //创建ES客户端 RestHighLevelClient esClient = new RestHighLevelClient( RestClient.builder(new HttpHost("localhost",9200,"http")) ...原创 2021-08-16 10:43:27 · 338 阅读 · 0 评论 -
Java Api elasticsearch 模糊查询
public class ESTest_Doc_Query { public static void main(String[] args) throws Exception { //创建ES客户端 RestHighLevelClient esClient = new RestHighLevelClient( RestClient.builder(new HttpHost("localhost",9200,"http")) ...原创 2021-08-13 20:39:02 · 548 阅读 · 0 评论 -
Java Api elasticsearch 范围查询
public class ESTest_Doc_Query { public static void main(String[] args) throws Exception { //创建ES客户端 RestHighLevelClient esClient = new RestHighLevelClient( RestClient.builder(new HttpHost("localhost",9200,"http")) ...原创 2021-08-13 20:12:54 · 749 阅读 · 0 评论 -
Java Api elasticsearch 组合查询
public class ESTest_Doc_Query { public static void main(String[] args) throws Exception { //创建ES客户端 RestHighLevelClient esClient = new RestHighLevelClient( RestClient.builder(new HttpHost("localhost",9200,"http")) ...原创 2021-08-13 20:09:54 · 173 阅读 · 0 评论 -
Java Api elasticsearch 过滤查询
public class ESTest_Doc_Query { public static void main(String[] args) throws Exception { //创建ES客户端 RestHighLevelClient esClient = new RestHighLevelClient( RestClient.builder(new HttpHost("localhost",9200,"http")) ...原创 2021-08-13 20:05:01 · 253 阅读 · 0 评论 -
Java Api elasticsearch 查询排序
这里按照年龄降序排序public class ESTest_Doc_Query { public static void main(String[] args) throws Exception { //创建ES客户端 RestHighLevelClient esClient = new RestHighLevelClient( RestClient.builder(new HttpHost("localhost",9200,"ht...原创 2021-08-13 20:01:05 · 454 阅读 · 0 评论 -
Elasticsearch--JAVA API 分页查询
查询页码及页码所展示的条数public class ESTest_Doc_Query { public static void main(String[] args) throws Exception { //创建ES客户端 RestHighLevelClient esClient = new RestHighLevelClient( RestClient.builder(new HttpHost("localhost",9200,...原创 2021-08-13 15:57:25 · 719 阅读 · 0 评论 -
使用Java Api 查询ElasticSearch 索引 条件查询
查询 索引 user 中 年龄 为 30 岁的信息public class ESTest_Doc_Query { public static void main(String[] args) throws Exception { //创建ES客户端 RestHighLevelClient esClient = new RestHighLevelClient( RestClient.builder(new HttpHost("loc...原创 2021-08-13 10:54:23 · 628 阅读 · 1 评论 -
使用Java Api 查询ElasticSearch 索引中的全部数据
public class ESTest_Doc_Query { public static void main(String[] args) throws Exception { //创建ES客户端 RestHighLevelClient esClient = new RestHighLevelClient( RestClient.builder(new HttpHost("localhost",9200,"http")) ...原创 2021-08-13 10:50:36 · 9706 阅读 · 2 评论 -
Java Api 更新ES索引
更新索引 user 下,id:1002 的性别,将“男” 更新为“女”import org.apache.http.HttpHost;import org.elasticsearch.action.update.UpdateRequest;import org.elasticsearch.action.update.UpdateResponse;import org.elasticsearch.client.RequestOptions;import org.elasticsearch.cl.原创 2021-08-12 15:26:03 · 668 阅读 · 0 评论 -
Java Api删除ES索引
删除一个user 索引:import org.apache.http.HttpHost;import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;import org.elasticsearch.action.support.master.AcknowledgedResponse;import org.elasticsearch.client.RequestOptions;import org.elastics.原创 2021-08-12 14:03:05 · 1242 阅读 · 0 评论 -
Java Api 查询ES索引
import org.apache.http.HttpHost;import org.elasticsearch.client.RequestOptions;import org.elasticsearch.client.RestClient;import org.elasticsearch.client.RestHighLevelClient;import org.elasticsearch.client.indices.GetIndexRequest;import org.elasticse.原创 2021-08-12 13:59:29 · 1629 阅读 · 1 评论 -
java Api 实现创建elasticsearch 索引
创建一个索引名为:user 的ES索引:import org.apache.http.HttpHost;import org.elasticsearch.client.RequestOptions;import org.elasticsearch.client.RestClient;import org.elasticsearch.client.RestHighLevelClient;import org.elasticsearch.client.indices.CreateIndexRequ.原创 2021-08-12 13:56:20 · 206 阅读 · 0 评论