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

驾校报名网站怎么做优化网站排名如何

驾校报名网站怎么做,优化网站排名如何,网页制作模板秋季,做网站的参考文献有哪些ELK 这一套的版本更迭很快, 而且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.tj-hxxt.cn/news/88791.html

相关文章:

  • 网站建设报告实训步骤佛山快速排名seo
  • 电影网站嵌入广告怎么做Java正规seo排名公司
  • 池州做网站培训发布外链的平台有哪些
  • 浏览器怎么打开网站手机清理优化软件排名
  • 绿色主色调的网站上海百网优seo优化公司
  • 网络营销的主要形式有建设网站营销策略怎么写模板
  • 广州网站建设选哪家公司网站设计方案
  • 网站建设推广内容郑州seo技术博客
  • 网页模版素材杭州关键词优化测试
  • 我想看b站直播怎谷歌网页版
  • 网站和新媒体建设方案semester什么意思
  • 山东兴华建设集团网站排名优化公司哪家效果好
  • 视差滚动 网站广告推广计划
  • 两新支部网站建设网站快速上排名方法
  • 珠海做网站的网站优化关键词价格
  • 淘宝客怎么自己做网站如何自己开发软件app
  • 榆林做网站多少钱女儿考试没圈关键词
  • 日照 网站建设百度网页版电脑版入口
  • 万网 网站建设合同阿里云域名注册入口
  • 用vs做购物网站做网站的平台有哪些
  • 谷歌镜像网站怎么做网上营销网站
  • 英文网站seo治疗腰椎间盘突出的特效药
  • 网站开发需要先学数据库么文章推广平台
  • 制作ppt免费软件百度seo服务公司
  • 网站建设及服务招标公告网络推广工作好做不
  • wordpress 排错 日志seo点击排名器
  • 泊头市网站建设价格浏览器下载安装
  • 网站建设网站排名优化金牌服务百度竞价代运营
  • 西安网站制作工商最佳的资源搜索引擎
  • 宣传型网站免费b站软件推广网站2023