当前位置: 首页 > news >正文

做网站前端要会什么泰安百度推广公司

做网站前端要会什么,泰安百度推广公司,项目立项流程图,企业网b2bELK 这一套的版本更迭很快, 而且es常有不兼容的东西出现, 经常是搜一篇文章,看似能用,拿到我这边就不能用了。 很是烦恼。 我这边的ELK版本目前是 6.8.18,这次的操作记录一下。 (涉密内容略有删改&#xf…

ELK 这一套的版本更迭很快,
而且es常有不兼容的东西出现,
经常是搜一篇文章,看似能用,拿到我这边就不能用了。
很是烦恼。
我这边的ELK版本目前是 6.8.18,这次的操作记录一下。

(涉密内容略有删改,一看便知)

es版本信息:

{"name" : "es-client1","cluster_name" : "xt-logs-view","cluster_uuid" : "xxxxxxxxxxxx-UNg","version" : {"number" : "6.8.18","build_flavor" : "default","build_type" : "docker","build_hash" : "aca2329","build_date" : "2021-07-28T16:06:05.232873Z","build_snapshot" : false,"lucene_version" : "7.7.3","minimum_wire_compatibility_version" : "5.6.0","minimum_index_compatibility_version" : "5.0.0"},"tagline" : "You Know, for Search"
}

创建一个index,指定字段为date类型

kibana中的命令:

PUT my_index
{"mappings": {"_doc": {"properties": {"createTime": {"type":   "date","format": "yyyy-MM-dd HH:mm:ss"},"updateTime": {"type":   "date","format": "yyyy-MM-dd HH:mm:ss"}}}}
}

在这里插入图片描述

结合java项目中的类型

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MyIndex implements Serializable {//其他字段略/*** 创建时间*/@Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")@JSONField(format = "yyyy-MM-dd HH:mm:ss")private Date createTime;/*** 更新时间*/@Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")@JSONField(format = "yyyy-MM-dd HH:mm:ss")private Date updateTime;
}

java写入es (springboot)

        <dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId><version>6.8.18</version></dependency><dependency><groupId>org.springframework.data</groupId><artifactId>spring-data-elasticsearch</artifactId>           <version>3.1.11.RELEASE</version></dependency>

客户端配置

spring:data:elasticsearch:rest:uris: http://172.16.100.1:9200,http://172.16.100.2:9200,http://172.16.100.3:9200

@Data
@Configuration
public class ElasticSearchConfig {@Value("${spring.data.elasticsearch.rest.uris}")private String[] uris;@Beanpublic RestHighLevelClient restHighLevelClient() {//单机版//return new RestHighLevelClient(RestClient.builder(new HttpHost(host, port, "http")));//集群版HttpHost[] httpHosts = Arrays.stream(uris).map(HttpHost::create).toArray(HttpHost[]::new);//集群版RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(httpHosts));return client;}
}

java代码写入es

package cn.xxxxx.service.impl;import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.action.support.replication.ReplicationResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;/*** @author zss* @date 2024年7月16日* @Email:*/
@Slf4j
@Service
public class EsMyIndexServiceImpl implements EsMyIndexService {private static String ES_INDEX_NAME = "my_index";private static String ES_DOC_TYPE = "_doc";@AutowiredRestHighLevelClient restHighLevelClient;@Overridepublic void saveXxxx(MyIndex myIndex) {// 创建索引请求对象IndexRequest indexRequest = new IndexRequest(ES_INDEX_NAME, ES_DOC_TYPE);indexRequest.source(JSON.toJSONString(myIndex), XContentType.JSON);indexRequest.timeout(TimeValue.timeValueSeconds(1));indexRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL);//数据为存储而不是更新indexRequest.create(false);//indexRequest.id(mqRecord.getId() + "");// 执行增加文档restHighLevelClient.indexAsync(indexRequest, RequestOptions.DEFAULT, new ActionListener<IndexResponse>() {@Overridepublic void onResponse(IndexResponse indexResponse) {ReplicationResponse.ShardInfo shardInfo = indexResponse.getShardInfo();if (shardInfo.getFailed() > 0) {for (ReplicationResponse.ShardInfo.Failure failure : shardInfo.getFailures()) {log.error("mqRecord {} 存入ES时失败,原因为:{}", JSON.toJSONString(mqRecord), failure.getCause());}}}@Overridepublic void onFailure(Exception e) {log.error("mqRecord {} 存入es时异常,数据信息为", JSON.toJSONString(mqRecord), e);}});}}

kibana创建索引模式

创建索引模式

创建的索引模式里,终于可以指定某字段为时间字段了,从而可以使用时间范围搜索。

在这里插入图片描述

可按时间范围查

在这里插入图片描述

http://www.khdw.cn/news/26451.html

相关文章:

  • 成都网站设计制作常见的网络营销方式有哪几种
  • 安溪县住房和城乡规划建设局网站seo兼职接单平台
  • 温州做公众号和做网站的地方seo营销推广全程实例
  • 树状结构的网站谷歌paypal官网下载
  • 成人高考考试科目考哪些内容 学梯网seo搜索引擎优化介绍
  • 山西疫情最新情况今日新增在哪里网络营销seo优化
  • 网上做网站 干对缝儿生意青岛网站建设方案
  • wordpress 支持wmaseo优化对网店的推广的作用为
  • 做办公家具在哪个网站推销好微信软文案例
  • 香港网站建设最近一周新闻
  • 北京高端网站建设有限公司seo网络推广到底是做什么的
  • 长沙中小企业做网站安徽seo优化
  • 手机如何做车载mp3下载网站网络营销策划书的主要内容
  • 成都网站设计网站制作公司营销培训讲师
  • 网站做数据分析品牌推广包括哪些内容
  • 优秀flash网站欣赏排行榜
  • 深圳做积分商城网站公司网络推广深圳有效渠道
  • 移动网站不备案吗福州seo技术培训
  • 中国正品网购网站排名培训机构招生方案范文
  • 微信小程序视频网站开发教程营销活动策划方案
  • 迅睿cms模板北京网站优化方法
  • 自己制作上传图片的网站怎么做google搜索引擎入口下载
  • wordpress 在线联系seo关键词工具
  • 开拓网站建设论坛平台
  • 济南集团网站建设流程山东seo网页优化外包
  • 迅雷网站做爰视频平面设计
  • 河南省住房和城乡建设厅网站文件哈尔滨网站制作软件
  • 网页设计的交流网站编程培训机构
  • 手机版网站建设免费自建网站有哪些
  • 网站制作 合同seo哪家强