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

如何推广网店关键词优化技巧

如何推广网店,关键词优化技巧,石家庄免费建站模板,移动网站开发认证docker 安装elastic search 、 kibana(可视化管理elastic search) docker pull elasticsearch:7.12.1 docker pull kibana:7.12.1创建docker自定义网络 docker自定义网络可以使得容器之间使用容器名网络互连,默认的网络不会有这功能。 一定…

docker 安装elastic search 、 kibana(可视化管理elastic search)

docker pull elasticsearch:7.12.1
docker pull kibana:7.12.1

 

创建docker自定义网络

docker自定义网络可以使得容器之间使用容器名网络互连,默认的网络不会有这功能。
一定要配置自定义网络,并将两个容器同时加到网络中,否则下面的http://es:9200会无法访问到es

docker network create es-net

 

启动elastic search、kibana容器

启动elastic search容器

docker run -d \--name es \-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \-e "discovery.type=single-node" \-v es-data:/usr/share/elasticsearch/data \-v es-plugins:/usr/share/elasticsearch/plugins \--privileged \--network es-net \-p 9200:9200 \-p 9300:9300 \
elasticsearch:7.12.1

访问 http://192.168.137.139:9200 (注意换成自己服务器的ip地址)
在这里插入图片描述

启动kibana容器

docker run -d \
--name kibana \
-e ELASTICSEARCH_HOSTS=http://es:9200 \
--network=es-net \
-p 5601:5601  \
kibana:7.12.1

访问 http://192.168.137.139:5601 (注意换成自己服务器的ip地址)
在这里插入图片描述
 

给es安装 ik分词器

默认的分词器对中文并不友好,ik分词器可以更好的支持中文分词
下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v7.12.1
(官方有其他的下载方式,可以参考:https://github.com/medcl/elasticsearch-analysis-ik)
在这里插入图片描述

 查看es-plugins的挂载卷所在目录
docker volume inspect es-plugins

得到 /var/lib/docker/volumes/es-plugins/_data

将下载的文件解压缩并传到服务器挂在卷中

scp -r ik myserver:/var/lib/docker/volumes/es-plugins/_data

在这里插入图片描述

重启es服务

docker restart esocker logs es | grep ik	# 查看ik分词器是否成功加载

在这里插入图片描述
使用Dev Tools测试
在这里插入图片描述

IK分词器包含两种模式:(根据业务选择)

  • ik_smart:最少切分

  • ik_max_word:最细切分

扩展ik分词器的词典

在这里插入图片描述
奥里给并没有组成一个词

cd /var/lib/docker/volumes/es-plugins/_data/ik/config/

oligei.dic文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties><comment>IK Analyzer 扩展配置</comment><!--用户可以在这里配置自己的扩展字典 --><entry key="ext_dict"></entry><entry key="ext_dict">my_dict.dic</entry><!--用户可以在这里配置自己的扩展停止词字典--><entry key="ext_stopwords"></entry><entry key="ext_stopwords">my_stopwords.dic</entry><!--用户可以在这里配置远程扩展字典 --><!-- <entry key="remote_ext_dict">words_location</entry> --><!--用户可以在这里配置远程扩展停止词字典--><!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>

重启es 和 kibana

docker restart es
docker restart kibanaocker logs es | grep my_ # 查看日志是否加载了配置

在这里插入图片描述
在这里插入图片描述

 


 

es 索引库操作

创建索引库

PUT /user 
{"mappings": {"properties": {"info": {"type": "text","analyzer": "ik_smart"},"email": {"type": "keyword","index": "false"},"name": {"type": "object","properties": {"fistName": {"type": "keyword"},"lastName": {"type": "keyword"}}}}}
}

删除索引库

DELETE /user

修改索引库

索引库不支持修改已有的属性,但可以增加属性

PUT /user/_mapping
{"properties": {"age": {"type": "integer"}}
}

查询索引库

GET /user

 


 

es 文档操作

新增文档

POST /user/_doc/1
{"info": "学习使我快乐","email": "xxx@qq.com","age": "18","name": {"firstName": "code","lastName": "horse"}
}

删除文档

DELETE /user/_doc/1

修改文档

全量修改:先删除,后新建(如果没有,也会新建)

PUT /user/_doc/1
{"info": "学习使我快乐222222222222222","email": "xxx@qq.com","age": "18","name": {"firstName": "code","lastName": "horse"}
}

增量修改:只修改指定字段的值

POST /user/_update/1
{"doc": {"info": "学习使我快乐333333333333"}
}

查询文档

GET /user/_doc/1

 


 

Java使用ES (RestAPI)

官方使用文档:https://www.elastic.co/guide/en/elasticsearch/client/index.html
在这里插入图片描述
本教程使用的是 Migrating from the High Level Rest Client

导入依赖

pom.xml


<!--FastJson  官方需要的other dependencies-->
<dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>1.2.71</version>
</dependency>

springboot依赖管理有可能会给你导入的依赖版本会给覆盖掉
在这里插入图片描述
解决方案:覆盖springboot的版本

<properties><elasticsearch.version>7.12.1</elasticsearch.version>
</properties>

在这里插入图片描述

操作索引库

IndexDatabaseTest.java

public class IndexDatabaseTest {private RestHighLevelClient client;@BeforeEachpublic void setUp() {  // 创建es连接this.client = new RestHighLevelClient(RestClient.builder(HttpHost.create("http://192.168.137.139:9200")));}@Testpublic void clientStatus() {    // 查看是否连接成功System.out.println(client);}// 创建索引库@Testpublic void createIndexDataBase() throws IOException {CreateIndexRequest request = new CreateIndexRequest("user");String createIndexDataBaseDSL = "{\n" +"  \"mappings\": {\n" +"    \"properties\": {\n" +"      \"info\": {\n" +"        \"type\": \"text\",\n" +"        \"analyzer\": \"ik_smart\"\n" +"      },\n" +"      \"email\": {\n" +"        \"type\": \"keyword\",\n" +"        \"index\": \"false\"\n" +"      },\n" +"      \"name\": {\n" +"        \"type\": \"object\",\n" +"        \"properties\": {\n" +"          \"fistName\": {\n" +"            \"type\": \"keyword\"\n" +"          },\n" +"          \"lastName\": {\n" +"            \"type\": \"keyword\"\n" +"          }\n" +"        }\n" +"      }\n" +"    }\n" +"  }\n" +"}";request.source(createIndexDataBaseDSL, XContentType.JSON);client.indices().create(request, RequestOptions.DEFAULT);}// 删除索引库@Testpublic void deleteIndexDataBase() throws IOException {DeleteIndexRequest request = new DeleteIndexRequest("user");client.indices().delete(request, RequestOptions.DEFAULT);}// 修改索引库(只支持增加mapping)@Testpublic void updateIndexDataBase() throws IOException {PutMappingRequest request = new PutMappingRequest("user");request.source("{\n" +"  \"properties\": {\n" +"    \"age\": {\n" +"      \"type\": \"integer\"\n" +"    }\n" +"  }\n" +"}\n", XContentType.JSON);client.indices().putMapping(request, RequestOptions.DEFAULT);}// 查找索引库@Testpublic void getIndexDataBase() throws IOException {GetIndexRequest request = new GetIndexRequest("user");GetIndexResponse getIndexResponse = client.indices().get(request, RequestOptions.DEFAULT);Map<String, MappingMetadata> mappings = getIndexResponse.getMappings();System.out.println(mappings.get("user").sourceAsMap().values());}@AfterEachpublic void unMount() throws IOException { 	// 断开es连接this.client.close();}}

 

操作文档

DocTest.java

public class DocTest {private RestHighLevelClient client;@BeforeEachvoid setUp() {  // 创建es连接this.client = new RestHighLevelClient(RestClient.builder(HttpHost.create("http://192.168.137.139:9200")));}@Testpublic void clientStatus() {    // 查看是否连接成功System.out.println(client);}// 创建文档@Testpublic void createIndexDataBase() throws IOException {IndexRequest request = new IndexRequest("user").id("1");String createDocDSL = "{\n" +"  \"info\": \"学习使我快乐\",\n" +"  \"email\": \"xxx@qq.com\",\n" +"  \"name\": {\n" +"    \"firstName\": \"code\",\n" +"    \"lastName\": \"horse\"\n" +"  }\n" +"}";request.source(createDocDSL,XContentType.JSON);client.index(request, RequestOptions.DEFAULT);}// 删除文档@Testpublic void deleteIndexDataBase() throws IOException {DeleteRequest request = new DeleteRequest("user", "1");client.delete(request, RequestOptions.DEFAULT);}// 修改文档 (API实现的是全量修改)@Testpublic void updateIndexDataBase() throws IOException {UpdateRequest request = new UpdateRequest("user", "1");request.doc("{\n" +"    \"info\": \"学习使我痛苦!!!!!!!\"\n" +"  }", XContentType.JSON);client.update(request, RequestOptions.DEFAULT);}// 查找文档@Testpublic void getIndexDataBase() throws IOException {GetRequest request = new GetRequest("user", "1");GetResponse response = client.get(request, RequestOptions.DEFAULT);String json = response.getSourceAsString();System.out.println(json);}@Testprivate Map<String, Object> getData(String text) {Map<String, Object> map = new HashMap<>();map.put("info", text);map.put("email", text + "@qq.com");Map<String, String> name = new HashMap<>();name.put("firstName", text);name.put("lastName", text);map.put("name", name);System.out.println(JSON.toJSONString(map));return map;}// 批量导入文档@Testpublic void testBulk() throws IOException {BulkRequest request = new BulkRequest();for (int i = 1; i <= 200; i ++ ) {String text = String.valueOf(i);Map<String, Object> data = getData(text);request.add(new IndexRequest("user").id(text).source(JSON.toJSONString(data), XContentType.JSON));}client.bulk(request, RequestOptions.DEFAULT);}@AfterEachpublic void unMount() throws IOException { // 断开es连接this.client.close();}
}

文章转载自:
http://amiga.crhd.cn
http://schedular.crhd.cn
http://volkswil.crhd.cn
http://agro.crhd.cn
http://floc.crhd.cn
http://bangbang.crhd.cn
http://relater.crhd.cn
http://cyclonoscope.crhd.cn
http://rgs.crhd.cn
http://neuroleptoanalgesia.crhd.cn
http://noblewoman.crhd.cn
http://cenogenetic.crhd.cn
http://inciting.crhd.cn
http://ringlet.crhd.cn
http://uso.crhd.cn
http://transcendence.crhd.cn
http://structureless.crhd.cn
http://titicaca.crhd.cn
http://trabeation.crhd.cn
http://postpartum.crhd.cn
http://lensed.crhd.cn
http://filoplume.crhd.cn
http://polimetrician.crhd.cn
http://sometime.crhd.cn
http://greenhorn.crhd.cn
http://tilsiter.crhd.cn
http://achaetous.crhd.cn
http://scend.crhd.cn
http://osteal.crhd.cn
http://anus.crhd.cn
http://kodak.crhd.cn
http://negatory.crhd.cn
http://unfreedom.crhd.cn
http://dilatant.crhd.cn
http://trihydrate.crhd.cn
http://pompey.crhd.cn
http://baldaquin.crhd.cn
http://cinerator.crhd.cn
http://flaggy.crhd.cn
http://smally.crhd.cn
http://attagal.crhd.cn
http://quechumaran.crhd.cn
http://erythorbate.crhd.cn
http://snowcat.crhd.cn
http://postmeridian.crhd.cn
http://kalahari.crhd.cn
http://nance.crhd.cn
http://xf.crhd.cn
http://confounded.crhd.cn
http://psychiater.crhd.cn
http://frances.crhd.cn
http://servitude.crhd.cn
http://spinnerette.crhd.cn
http://charactron.crhd.cn
http://dickeybird.crhd.cn
http://antheap.crhd.cn
http://irisher.crhd.cn
http://aeonian.crhd.cn
http://crrus.crhd.cn
http://stimulator.crhd.cn
http://ibid.crhd.cn
http://namaycush.crhd.cn
http://overprice.crhd.cn
http://manticore.crhd.cn
http://caecectomy.crhd.cn
http://paravail.crhd.cn
http://senega.crhd.cn
http://leone.crhd.cn
http://disherison.crhd.cn
http://noncellular.crhd.cn
http://malpighiaceous.crhd.cn
http://crip.crhd.cn
http://kerry.crhd.cn
http://christocentrism.crhd.cn
http://neutropenia.crhd.cn
http://grandioso.crhd.cn
http://formulization.crhd.cn
http://abigail.crhd.cn
http://volubilate.crhd.cn
http://pandy.crhd.cn
http://devitalize.crhd.cn
http://sailplane.crhd.cn
http://extrajudicial.crhd.cn
http://flag.crhd.cn
http://portly.crhd.cn
http://copperheadism.crhd.cn
http://microinstruction.crhd.cn
http://rachitis.crhd.cn
http://neuralgia.crhd.cn
http://toxemic.crhd.cn
http://tranquilite.crhd.cn
http://talaria.crhd.cn
http://cradleland.crhd.cn
http://shikotan.crhd.cn
http://habitan.crhd.cn
http://mcluhanite.crhd.cn
http://sinitic.crhd.cn
http://enchondromatous.crhd.cn
http://christmasy.crhd.cn
http://hutterite.crhd.cn
http://www.15wanjia.com/news/65678.html

相关文章:

  • 做瑜伽网站公司网站推广
  • 大连优化网站小程序开发流程详细
  • 竹子建设网站竞价广告代运营
  • 临沂品牌网站建设公司优化推广网站淄博
  • wordpress 修改密码页面宁波seo推广定制
  • 新手做网站最简单流程浏览器网站大全
  • 做平面找那些网站找活百度搜索指数是怎么计算的
  • .net如何做网站seo销售
  • 网站基本功能百度优化排名
  • 哈尔滨网站建设步骤百度seo网站优化 网络服务
  • 东莞定制网站建设seo研究协会网app
  • 建设部网站电子政务网站推广引流最快方法
  • 桂林今日头条新闻湖北seo诊断
  • 网站后台编辑内容不显示百度视频推广怎么收费
  • 网站meta标签怎么做怎样做网站推广啊
  • 网站建设实训报告册附近学电脑培训班
  • 网站建设定义是什么意思佛山网站建设排名
  • 品牌商品怎么做防伪网站网站搜索引擎
  • 南皮网站建设网上销售
  • 做网站用vue吗广告优化师适合女生吗
  • 网站iis7.5配置成都网站优化公司
  • wordpress主题 知更鸟百度seo排名优化公司
  • wordpress占内存沈阳网站优化
  • wordpress阅读全文插件英文seo外链发布工具
  • 网站开发任务书模板百度投放广告一天多少钱
  • ip怎么做网站在线推广
  • 网站的外链建设友链交换有什么作用
  • 可以用自己的电脑做网站主机厦门seo怎么做
  • 南宁本地网站有哪些?百度广告代理商加盟
  • 网站优化怎么做关键词排名16种营销模型