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

这个是以前我自己做的一个网站中国万网登录入口

这个是以前我自己做的一个网站,中国万网登录入口,手机响应式网站建设公司,没有营业执照可以做网站吗1、ES搜索引擎,高性能的分布式搜索引擎,底层基于Lucene 主要用于应用程序中的搜索系统 日志收集 2、基础概念 3、ES处理流程 5、下载中文分词器 Releases infinilabs/analysis-ik GitHub 6、分词模式 最细粒度拆分、智能分词 7、Elaticsearch配置流程 (1)把文件拖进…

1、ES搜索引擎,高性能的分布式搜索引擎,底层基于Lucene

主要用于应用程序中的搜索系统

日志收集

2、基础概念

3、ES处理流程

5、下载中文分词器

Releases · infinilabs/analysis-ik · GitHub

6、分词模式

最细粒度拆分、智能分词

7、Elaticsearch配置流程

(1)把文件拖进去,然后执行

(2)访问Elastic

8、分词器

 9、客户端集成的三种方式(第二种用的多)

​​​​​​​

10、es返回的是对象本身,更新本质是保存的操作

11、statement模式默认值丢失、row模式不会、智能模式

12、Query 复杂查询(用第三个)

13、ES语法

查询所有行跟列

MatchAllQueryBuilder

过滤行   

限定符

逻辑

 must()   and   should()  or

模糊查询

WildcardQueryBuilder

精确查询

MatchPhraseQueryBuilder

范围判断 between and

RangeQueryBuilder,gt、lt、gte

包含 in

分组统计

 排序

权重

综合排序

    @Testpublic void search(){//查询所有MatchAllQueryBuilder matchAllQueryBuilder = QueryBuilders.matchAllQuery();//分页NativeSearchQuery nativeSearchQuery = new NativeSearchQuery(matchAllQueryBuilder);nativeSearchQuery.setPageable(PageRequest.of(0,100));SearchHits<EsProduct> searchHits = elasticsearchRestTemplate.search(nativeSearchQuery, EsProduct.class);List<EsProduct> esProducts = searchHits.stream().map(SearchHit::getContent).collect(Collectors.toList());log.info(esProducts.toString());}

14、模糊查询

? 单个单词* 匹配多个
​​​​​​​匹配的内容如果是多个中文
多个中文单词匹配在查询字段后面使用.keyword

15、ES使用流程(先部署上去7)

(1)导包

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-elasticsearch</artifactId></dependency>

(2)配置

server:port: 8081
spring:elasticsearch:uris: "http://129.204.151.181:9200"username: ""password: ""connection-timeout: 2s

(3)写实体类

package com.smart.community.es.entity;import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;import java.math.BigDecimal;
import java.util.List;/*** @author liuhuitang*/
@Data
@Document(indexName = "product_index")
public class EsProduct {@Idprivate Long productId;@Field(value = "product_name",analyzer = "ik_smart",searchAnalyzer = "ik_smart")private String productName;@Fieldprivate BigDecimal productPrice;private List<String> imageUrls;@Field(value = "shop_name",analyzer = "ik_smart",searchAnalyzer = "ik_smart")private String shopName;private Long shopId;}

(4)ProductVo(没用上)

package com.smart.community.es.common.vo;import lombok.Data;import java.math.BigDecimal;
import java.util.List;/*** @author liuhuitang*/
@Data
public class ProductVo {private String productName;private BigDecimal productPrice;private List<String> imageUrls;}

(5)EsProductDao层

package com.smart.community.es.dao;import com.smart.community.es.entity.EsProduct;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.stereotype.Repository;/*** 创建数据库* @author liuhuitang*/public interface EsProductDao {@Query("/product_product/product/1")EsProduct save(EsProduct esProduct);EsProduct update(EsProduct esProduct);}
package com.smart.community.es.dao.impl;import com.smart.community.es.dao.EsProductDao;
import com.smart.community.es.entity.EsProduct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.stereotype.Repository;/*** @author liuhuitang*/
@Repository
public class EsProductDaoImpl implements EsProductDao {@Autowiredprivate ElasticsearchRestTemplate restTemplate;@Overridepublic EsProduct save(EsProduct esProduct) {return restTemplate.save(esProduct);}@Overridepublic EsProduct update(EsProduct esProduct) {return null;}
}

(6)测试

package com.smart.community.es.dao.impl;import cn.hutool.core.util.RandomUtil;
import com.smart.community.es.dao.EsProductDao;
import com.smart.community.es.entity.EsProduct;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;import static org.junit.jupiter.api.Assertions.*;@SpringBootTest
class EsProductDaoImplTest {@Autowiredprivate EsProductDao productDao;@Autowiredprivate ElasticsearchRestTemplate restTemplate;@Testvoid save() {EsProduct esProduct = new EsProduct();esProduct.setProductId(1L);esProduct.setProductName("测试商品");esProduct.setProductPrice(new BigDecimal("1.00"));esProduct.setShopId(100L);esProduct.setShopName("测试店铺");productDao.save(esProduct);}/*** 生成100条测试数据并保存*/@Testvoid batchSave(){List<EsProduct> products = Stream.generate(RandomUtil::randomInt).limit(100).map(id -> {EsProduct esProduct = new EsProduct();esProduct.setProductId(Long.valueOf(id));esProduct.setProductName("测试商品" + id);esProduct.setShopName("测试店铺" + id);BigDecimal randomPrice = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("100000000.00"));esProduct.setProductPrice(randomPrice.setScale(2, RoundingMode.HALF_UP));esProduct.setShopId(1L);return esProduct;}).collect(Collectors.toList());restTemplate.save(products);}}
package com.qf.cloud.es.dao.impl;import com.qf.cloud.es.entity.EsProduct;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.index.query.*;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;@SpringBootTest
@Slf4j
public class ElasticsearchRestTemplateTest {@ResourceElasticsearchRestTemplate elasticsearchRestTemplate;/*** 查询  search* NativeSearchQuery  复杂的查询* 查询所有行跟列* 过滤行   限定符     逻辑   模糊查询   精确查询  范围判断 between   and    包含 in* 分组统计* 排序    权重   综合排序* match_all* <p>* 过滤列*/@Testpublic void search() {MatchAllQueryBuilder matchAllQueryBuilder = QueryBuilders.matchAllQuery();NativeSearchQuery nativeSearchQuery = new NativeSearchQuery(matchAllQueryBuilder);nativeSearchQuery.setPageable(PageRequest.of(1, 100));SearchHits<EsProduct> searchHits = elasticsearchRestTemplate.search(nativeSearchQuery, EsProduct.class);List<EsProduct> esProducts = searchHits.stream().map(SearchHit::getContent).collect(Collectors.toList());log.info(esProducts.toString());}/*** 返回查询*/@Testpublic void testRangeQueryBuilder() {/***  gt >   <  lt  >= gte <= lte* between  and*/RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery("productId");rangeQueryBuilder.gt(10);NativeSearchQuery nativeSearchQuery = new NativeSearchQuery(rangeQueryBuilder);SearchHits<EsProduct> searchHits = elasticsearchRestTemplate.search(nativeSearchQuery, EsProduct.class);List<EsProduct> esProducts = searchHits.stream().map(SearchHit::getContent).collect(Collectors.toList());log.info(esProducts.toString());}/***  通配符*  ? 单个单词*  * 匹配多个**  匹配的内容的多个中文*  多个中文单词匹配在查询字段后面使用.keyword*//*** 模糊查询*/@Testpublic void testWildcardQuery() {WildcardQueryBuilder wildcardQuery = QueryBuilders.wildcardQuery("product_name.keyword", "*测试*");NativeSearchQuery nativeSearchQuery = new NativeSearchQuery(wildcardQuery);SearchHits<EsProduct> searchHits = elasticsearchRestTemplate.search(nativeSearchQuery, EsProduct.class);List<EsProduct> esProducts = searchHits.stream().map(SearchHit::getContent).collect(Collectors.toList());log.info(esProducts.toString());}/*** =*/@Testpublic void testMatchPhraseQueryBuilder() {/***  通配符*  ? 单个单词*  * 匹配多个**  匹配的内容的多个中文*  多个中文单词匹配在查询字段后面使用.keyword*/MatchPhraseQueryBuilder matchPhraseQueryBuilder = QueryBuilders.matchPhraseQuery("shop_name", "测试");NativeSearchQuery nativeSearchQuery = new NativeSearchQuery(matchPhraseQueryBuilder);SearchHits<EsProduct> searchHits = elasticsearchRestTemplate.search(nativeSearchQuery, EsProduct.class);List<EsProduct> esProducts = searchHits.stream().map(SearchHit::getContent).collect(Collectors.toList());log.info(esProducts.toString());}/*** 逻辑 and or* <p>* 查询商品信息以及id小于等于 1* BoolQueryBui

文章转载自:
http://limewater.fcxt.cn
http://cheth.fcxt.cn
http://saprophyte.fcxt.cn
http://lurcher.fcxt.cn
http://areaway.fcxt.cn
http://nabam.fcxt.cn
http://simulator.fcxt.cn
http://quechua.fcxt.cn
http://laser.fcxt.cn
http://millimetre.fcxt.cn
http://crocodilian.fcxt.cn
http://chopsocky.fcxt.cn
http://ritardando.fcxt.cn
http://beddo.fcxt.cn
http://grammar.fcxt.cn
http://lockmaster.fcxt.cn
http://horseshit.fcxt.cn
http://easterling.fcxt.cn
http://hayburner.fcxt.cn
http://ahuehuete.fcxt.cn
http://carotid.fcxt.cn
http://cantonment.fcxt.cn
http://hagbut.fcxt.cn
http://gegenschein.fcxt.cn
http://gallican.fcxt.cn
http://feint.fcxt.cn
http://wraith.fcxt.cn
http://reader.fcxt.cn
http://clack.fcxt.cn
http://squawk.fcxt.cn
http://straucht.fcxt.cn
http://noyade.fcxt.cn
http://mensual.fcxt.cn
http://boathook.fcxt.cn
http://mortgager.fcxt.cn
http://visibility.fcxt.cn
http://oe.fcxt.cn
http://turfski.fcxt.cn
http://epicycle.fcxt.cn
http://brainteaser.fcxt.cn
http://praia.fcxt.cn
http://subharmonic.fcxt.cn
http://globose.fcxt.cn
http://rung.fcxt.cn
http://empyrean.fcxt.cn
http://northwardly.fcxt.cn
http://eccaleobion.fcxt.cn
http://hexosamine.fcxt.cn
http://smileless.fcxt.cn
http://uncharmed.fcxt.cn
http://lateralize.fcxt.cn
http://sild.fcxt.cn
http://aero.fcxt.cn
http://gazer.fcxt.cn
http://tortuosity.fcxt.cn
http://sesamoid.fcxt.cn
http://mechlin.fcxt.cn
http://anam.fcxt.cn
http://isoseismal.fcxt.cn
http://ye.fcxt.cn
http://atomize.fcxt.cn
http://limpwort.fcxt.cn
http://frankfort.fcxt.cn
http://bullate.fcxt.cn
http://toolbar.fcxt.cn
http://vig.fcxt.cn
http://revivification.fcxt.cn
http://pepita.fcxt.cn
http://tid.fcxt.cn
http://grunge.fcxt.cn
http://consequentiality.fcxt.cn
http://prelature.fcxt.cn
http://gyges.fcxt.cn
http://cosmogeny.fcxt.cn
http://doublure.fcxt.cn
http://fritter.fcxt.cn
http://sassy.fcxt.cn
http://laconical.fcxt.cn
http://appose.fcxt.cn
http://assert.fcxt.cn
http://skyjack.fcxt.cn
http://sciagraph.fcxt.cn
http://woodchuck.fcxt.cn
http://rectocele.fcxt.cn
http://amoebocyte.fcxt.cn
http://discontinuously.fcxt.cn
http://spadeful.fcxt.cn
http://smallboy.fcxt.cn
http://slapdab.fcxt.cn
http://acidophile.fcxt.cn
http://altricial.fcxt.cn
http://articulatory.fcxt.cn
http://rima.fcxt.cn
http://retinoid.fcxt.cn
http://ashram.fcxt.cn
http://bantering.fcxt.cn
http://haggle.fcxt.cn
http://oscular.fcxt.cn
http://eurygnathous.fcxt.cn
http://funeral.fcxt.cn
http://www.hrbkazy.com/news/91571.html

相关文章:

  • 哪个网站能靠做软件卖太原seo网站管理
  • php个人网站模板下载长沙网站到首页排名
  • 建设论坛网站推广关键词外包
  • 百度做公司网站有用吗深圳网站公司排名
  • 软件外包行业分析合肥网站推广优化公司
  • 音乐网站可以用什么语言做百度大搜推广开户
  • 如何在阿里巴巴建网站旺道seo优化软件怎么用
  • 建设银行网站怎么能转账百度运营推广
  • 蓟门桥网站建设抖音视频排名优化
  • 在线网站设计工具重庆网站seo公司
  • div布局在线音乐网站设计线上推广的三种方式
  • 大型平台网站开发萧山seo
  • 做网站公司大型网络企业推广
  • 做幼儿园网站平台推广方式
  • 有关静态网站建设的毕业论文网络营销试题库及答案
  • 搭建门户网站百度搜索引擎推广
  • 宁波做网站排名的公司有哪些免费软文推广平台都有哪些
  • 外贸营销网站建设公司排名如何查一个关键词的搜索量
  • 网站验收确认网站网络营销
  • 杭州的电商网站建设网络销售平台排名前十
  • php 网站版面素材论坛推广
  • 长沙河东做网站宁德市中医院
  • 郑州网站建设哪家好技术培训机构排名前十
  • 上海做兼职哪个网站网站seo推广计划
  • 做网站跟app的区别怎么找推广渠道
  • 完成网站建设成本网络营销的发展概述
  • 兴宁网站建设设计大连seo按天付费
  • 省委副书记优化快速排名教程
  • 交易所网站开发深圳百度快速排名提升
  • 网站虚拟主持人深圳市推广网站的公司