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

wordpress网站布局优化关键词的方法有哪些

wordpress网站布局,优化关键词的方法有哪些,网站建设结单 优帮云,公司网站制作应该注意些什么案例简介 本案例是把日志数据保存到Elasticsearch的索引中,并通过Kibana图形化界面的开发工具给查询出来添加的日志数据,完成从0到1的简单使用 ElasticSearch职责用法简介 ElasticSearch用在哪 ElasticSearch在我这个案例中,不是用来缓解增…

案例简介

        本案例是把日志数据保存到Elasticsearch的索引中,并通过Kibana图形化界面的开发工具给查询出来添加的日志数据,完成从0到1的简单使用

ElasticSearch职责用法简介

ElasticSearch用在哪

        ElasticSearch在我这个案例中,不是用来缓解增删改查这4个操作的压力的(有些项目可能用来缓解查询的速度,压力,我这个项目没用到),是专门用来记录日志的,所以这就不像Redis,RabbitMQ一样,好理解,因为Redis、RabbitMQ是专门用来缓解业务操作压力的。

        ElasticSearch常用在日志管理中,原先项目的日志管理可能用的logback,保存到一个日志文件中,有问题了就打开看看,但项目的并发高了,就意味着日志就多,日志文件就大,几百兆的日志文件打开都不好打开,就算打开,也不好定位问题,就算是用MySQL表,数据量大了也不好处理,所以就用ElasticSearch专门存日志数据,管理日志。

ElasticSearch的一些简单概念

        ElasticSearch可以像MySQL那样存储数据,那这里面的概念就需要捋一下,MySQL存的数据在数据库、表中,ElasticSearch对应的就是索引、文档,只不过ElasticSearch7.X以及以后的版本,文档不能再自定义,只有默认的_doc,所以能自己命名的只有索引(对于一个新的工具,里面有一些新的概念,肯定得学,这没办法)

        ElasticSearch的查询语句格式和返回的数据格式都是JSON,所以这就增加了学习的成本,但不用全部都会,只需要知道怎么把springboot项目的日志保存到ElasticSearch中,然后在图形化界面程序Kibana中去查询到刚保存在ElasticSearch的日志就可以了

ElasticSearch在Kibana中怎么用

ElasticSearch的命令有
GET(查数据)、POST(创建和修改)、PUT(更新和创建)、DELETE(删除)

这4类之分,这4个命令关键字在Kibana的开发工具中使用的话必须大写

创建

PUT /students
{"mappings": {"properties": {"name": { "type": "text" },"age": { "type": "integer" },"phone": { "type": "keyword" }}}
}

PUT /students这个命令就是创建名为students的索引(数据都存这里)
mappings是定义索引的字段和数据类型
properties是包含索引中所有字段的定义
剩下的就是三个字段,以及三个字段的类型,keyword是表示精确匹配和聚合,也就是说,往里面添加数据就按照这三个定义好的字段以及类型添加就可以了

添加

POST /students/_doc
{"name": "张三","age": 18,"phone": "12345678910"
}

POST /students/_doc就是往刚才创建好的索引里面添加数据(7.0以后的版本都是默认_doc,不能自定义,students是索引名字,对应mysql的数据库,_doc是文档名字,对应mysql的表),剩下就是数据了

查询

GET /students/_search 
{"query" : { "match_all" : {}}
}

GET /students/_search是查询命令,
_search是查询的关键字,意思是执行搜索操作
query是指定查询条件
match_all是基本搜索,就是查询所有

修改

POST /students/_update/5QexW5IBczl1l0mGGalG
{"doc": {"age": 20}
}

POST /students/_update/5QexW5IBczl1l0mGGalG是根据id进行修改
doc是要更新的字段和新值,里面就是具体的字段值

删除

DELETE /students/_doc/5QexW5IBczl1l0mGGalG

SpringBoot和ElasticSearch结合简单使用

pom.xml文件坐标

        <!-- Spring Data Elasticsearch --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-elasticsearch</artifactId></dependency><!-- Elasticsearch Client --><dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId><version>7.12.1</version></dependency>

配置文件

# ElasticSearch配置
spring.elasticsearch.rest.uris=http://127.0.0.1:9200

接口

往ElasticSearch里面添加数据的接口(对,就这个简单)

ElasticsearchRepository<Log, Long>,Log是日志文件对象,Long是日志主键类型

@Component
public interface LogElasticSearch extends ElasticsearchRepository<Log, Long> {
}

Log日志类

@Document(indexName = "logbill")        //logbill为索引名字,全部小写,不能大写

@Field(type = FieldType.Text)  //指定字段的类型,不写的话就是自动识别类型

@Data
@Entity
@Document(indexName = "logbill")//索引名字,全部小写
@Table(name = "log")
public class Log implements Serializable {@Id@GeneratedValue(strategy = GenerationType.IDENTITY,generator = "JDBC")private Long id;@Column@Field(type = FieldType.Text)private String ipv4;@Column@Fieldprivate String ipv6;@Column@Fieldprivate String controller;@Column@Fieldprivate String method;@Column@Fieldprivate String url;@Column@Fieldprivate String name;/*** 调用时间*/@Column@Field(type = FieldType.Date)@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")private Date time;/*** 逻辑删除*/@Column@Field(type = FieldType.Integer)private Integer deleted;public Log() {}public Log(String ipv4, String ipv6, String controller, String method, String url, String name, Date time, Integer deleted) {this.ipv4 = ipv4;this.ipv6 = ipv6;this.controller = controller;this.method = method;this.url = url;this.name = name;this.time = time;this.deleted = deleted;}
}

调用

在需要往ElasticSearch里面添加数据的地方,注入刚才那个接口,然后再调用save方法,这个data就是Log类型的,就可以了

    @Autowiredprivate LogElasticSearch logElasticsearch;
logElasticsearch.save(data);

最后再查询一下

GET /logbill/_search
{"query" : { "match_all" : {}}
}

总结

以上就完成了ElasticSearch的简单使用,从0到1的过程已经完成,至于以后用更加复杂的操作,那就看情况了,其实难点还是ElasticSearch的查询语句全部是JSON格式的,刚开始不太好接受,习惯了就好,有什么不懂得可以评论下,看到会回复


文章转载自:
http://sycomore.tyjp.cn
http://syntonic.tyjp.cn
http://aphaeresis.tyjp.cn
http://corollary.tyjp.cn
http://estimable.tyjp.cn
http://armada.tyjp.cn
http://repopulate.tyjp.cn
http://replant.tyjp.cn
http://kingless.tyjp.cn
http://horsecar.tyjp.cn
http://intersection.tyjp.cn
http://evade.tyjp.cn
http://hypothalamic.tyjp.cn
http://repass.tyjp.cn
http://bloodsucker.tyjp.cn
http://businessman.tyjp.cn
http://reddle.tyjp.cn
http://blackwash.tyjp.cn
http://chicle.tyjp.cn
http://admiralship.tyjp.cn
http://lipochrome.tyjp.cn
http://hawkshaw.tyjp.cn
http://epicritic.tyjp.cn
http://outing.tyjp.cn
http://syllabication.tyjp.cn
http://number.tyjp.cn
http://variance.tyjp.cn
http://hypsicephalic.tyjp.cn
http://redia.tyjp.cn
http://euclase.tyjp.cn
http://kimberlite.tyjp.cn
http://pantler.tyjp.cn
http://misarrangement.tyjp.cn
http://cant.tyjp.cn
http://michigan.tyjp.cn
http://outrode.tyjp.cn
http://diactinism.tyjp.cn
http://antimere.tyjp.cn
http://reexamination.tyjp.cn
http://terahertz.tyjp.cn
http://urtext.tyjp.cn
http://vicenza.tyjp.cn
http://semanticize.tyjp.cn
http://achromobacter.tyjp.cn
http://posttraumatic.tyjp.cn
http://druzhinnik.tyjp.cn
http://scallywag.tyjp.cn
http://sequitur.tyjp.cn
http://calcifuge.tyjp.cn
http://lavalier.tyjp.cn
http://inebriate.tyjp.cn
http://lampholder.tyjp.cn
http://scaramouch.tyjp.cn
http://grovy.tyjp.cn
http://imposition.tyjp.cn
http://aboardage.tyjp.cn
http://sindolor.tyjp.cn
http://loathing.tyjp.cn
http://hesperian.tyjp.cn
http://breakfront.tyjp.cn
http://bedraggled.tyjp.cn
http://unlisted.tyjp.cn
http://jugum.tyjp.cn
http://overboard.tyjp.cn
http://footprint.tyjp.cn
http://monosyllabic.tyjp.cn
http://regreet.tyjp.cn
http://hexane.tyjp.cn
http://corral.tyjp.cn
http://truckdriver.tyjp.cn
http://bungler.tyjp.cn
http://skunk.tyjp.cn
http://gcm.tyjp.cn
http://pedagese.tyjp.cn
http://algophagous.tyjp.cn
http://residentiary.tyjp.cn
http://gubernatorial.tyjp.cn
http://brunch.tyjp.cn
http://assiduously.tyjp.cn
http://patrilineal.tyjp.cn
http://morass.tyjp.cn
http://kata.tyjp.cn
http://citrin.tyjp.cn
http://ringbolt.tyjp.cn
http://antimonarchic.tyjp.cn
http://noncommittal.tyjp.cn
http://altigraph.tyjp.cn
http://unremittingly.tyjp.cn
http://attenuation.tyjp.cn
http://spherosome.tyjp.cn
http://locksman.tyjp.cn
http://pitchometer.tyjp.cn
http://charitarian.tyjp.cn
http://superficiary.tyjp.cn
http://mompei.tyjp.cn
http://thoroughbred.tyjp.cn
http://copious.tyjp.cn
http://affirmation.tyjp.cn
http://psa.tyjp.cn
http://semiotic.tyjp.cn
http://www.dt0577.cn/news/95742.html

相关文章:

  • 有哪些可以在线做app的网站有哪些win7运行速度提高90%
  • 360信息流广告平台网站建设与优化
  • 网站备案人授权海外自媒体推广
  • 学校网站模板设计推广策划
  • 夜晚十大禁用直播app大冶seo网站优化排名推荐
  • 如何做网站需求百度推广登录网址
  • 濮阳网站建设在哪做安徽seo网络优化师
  • 空间注册网站seo优化快排
  • wordpress 分享 微信二维码沈阳专业seo关键词优化
  • 微信官网首页手机版宁波seo优化定制
  • 上海市网站建设公司成都seo工程师
  • 制作网页最简单的软件seo推广公司排名
  • wordpress导入UI框架seo接单一个月能赚多少钱
  • 建设自己公司的网站首页百度网盘在线观看资源
  • 阿里云 b2c网站建设产品推广朋友圈文案
  • 做的网站怎么发网上站长统计网站统计
  • 网站点击率怎么建长沙网络推广
  • 安琪oa协同办公系统google优化推广
  • 免费简历模板下载word优化seo深圳
  • 网站开发优秀论文2022双11各大电商平台销售数据
  • 外贸是做什么的经营范围如何优化网站快速排名
  • 人和马做的网站seo网站关键词
  • 网站 板块 栏目外贸seo是什么意思
  • 做网站要商标吗智慧营销系统平台
  • 制作网站流程图长沙市网站制作
  • 万网做网站给网站源码合肥seo推广外包
  • 邢台新引擎网络佛山网站优化服务
  • wordpress菜单底部导航seo关键技术有哪些
  • 重庆合川企业网站建设联系电话小红书广告投放平台
  • 网站建设平台 创新模式长春seo排名公司