草庐IT

ES 修改数据

方法一:PUT和CREATE一样,PUT的时候将所有field带上,只调整修改的部分即可PUT/spouse/female/5{"name":"lengmeng","age":26,"desc":"actress"}返回结果;{"_index":"spouse","_type":"female","_id":"5","_version":2,//修改后,_version会+1,值代表数据改动的次数"result":"updated","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":6,"_primary_term":1}方法二

es索引分片重新分配cluster.routing.allocation

Index-levelshardallocationfiltering|ElasticsearchGuide[master]|Elasticindex.routing.allocation.include.{attribute}Assigntheindextoanodewhose {attribute} hasatleastoneofthecomma-separatedvalues.index.routing.allocation.require.{attribute}Assigntheindextoanodewhose {attribute} has all ofthecomma-separ

ES集群安装(docker)7.2.0

docker离线安装方法_探路者之旅的博客-CSDN博客部署步骤1.初始化es配置文件--拉取es镜像dockerpullelasticsearch:7.2.0--创建挂载目录[data:存放索引数据,plugins:存放es插件]mkdir-p/home/software/elasticsearchmkdir-p/home/software/elasticsearch/config/data1mkdir-p/home/software/elasticsearch/config/data2mkdir-p/home/software/elasticsearch/config/data3mkdir

pyflink map 字典写入ES

[root@masterpyflink]#cattest.py #-*-coding:utf-8-*-frompyflink.datastreamimportStreamExecutionEnvironmentfrompyflink.datastream.functionsimport MapFunction,RuntimeContext,KeyedProcessFunctionfromabcimportABC,abstractmethodfrompyflink.datastreamimportStreamExecutionEnvironmentfrompyflink.datastream.f

springboot整合ES索引引擎

在Springboot整合ES提供了启动依赖jar。该jar包封了一个类:RestHighLevelClient该类可以对象ES中各个接口进行相应的操作。1.创建springboot工程并导入相关的依赖2.3.12.RELEASE2.创建一个配置类,返回RestHighLevelClient修改一下版本创建路径config包下的ESconfig类@ConfigurationpublicclassESConfig{//springboot连接ES提供的一个客户端类.RestHighLevelClient@BeanpublicRestHighLevelClientrestHighLevelClie

es多字段模糊匹配wildcardQuery,java实现

es版本:7.10.1spring-cloud版本:2.3.5.RELEASEspring-boot-starter-data-elasticsearch版本 2.3.12.RELEASEspring-data-elasticsearch版本 4.0.9.RELEASEes查询,需求:title或者content任意一个字段能匹配到关键词即可DSL 使用dsl查询语句如下,构建一个query,should只要一个匹配即可POST/article/_search{"query":{"bool":{"should":[{"wildcard":{"title":"*路数*"}},{"wildcard

使用ES对一段中文进行分词

ES连接使用org.elasticsearch.client.RestHighLevelClient。获取分词的代码如下:importcom.alibaba.fastjson.JSON;importcom.alibaba.fastjson.JSONArray;importcom.alibaba.fastjson.JSONObject;importorg.apache.http.util.EntityUtils;importorg.elasticsearch.client.Request;importorg.elasticsearch.client.Response;importorg.elas

【elasticsearch】修改es集群的索引副本数量

前言最近海外es集群进行调整,从3节点变成了单节点。所以需要将集群模式改为单点模式,并需要将es集群的全部索引副本个数改为0,不然会有很多未分配的分片,导致集群状态为yellow。具体实践1.先将现有的index的副本数量为0个此步骤是为了解决现有的索引副本数。PUT*/_settings{"index":{"number_of_replicas":0}}2.创建模板匹配所有index,并设置副本数量为0此步骤是为了解决新增的索引副本数PUT_template/template_log{"order":0,"template":"*","settings":{"index":{"number_

Elasticsearch es查询结果只返回指定筛选字段_source

参考:https://www.exception.site/elasticsearch/elasticsearch-query-custom-columns1、查询特别值查询,结果只返回指定字段***只返回title、channel结果;下列两种语法方式都可以{"_source":["title","channel"],"query":{"term":{"aid":"cfxa***253i1y"}}}{"_source":["title","channel"],"query":{"query_string":{"default_field":"aid","query":"cfx***53i1y

es配合java使用--代码示范

本地搭建es镜像环境及谷歌插件可视化环境https://blog.csdn.net/qq_60191219/article/details/125867721?spm=1001.2014.3001.5501一:配置文件--用于配置链接elasticsearch:host:127.0.0.1port:9200scheme:httpdelayTime:10index:event:eventpeople:peopleplace:place二:es工具类--为service提供方法packagecom.spacesystech.config;importlombok.Getter;importorg.