ElasticSearch的一个坑,发现中文分词的Analyser不起作用,生成的mapping里面完全不包含指定的内容,得到的都是类似这样的结果:
ElasticSearch的一个坑,发现中文分词的Analyser不起作用,生成的mapping里面完全不包含指定的内容,得到的都是类似这样的结果:
发现我们使用的ElasticSearch的版本快过期了(end of life),计划升级,发现ElasticSearch将要淘汰原来的TransportClient转而力推High Level Rest Client了。
其它的问题都还好说,包的依赖和Client的初始化的不同影响面比较小,但是接口的不兼容影响比较大,不知道需要多少代价才能改完,不过好在都有各种测试代码了,修改应该可以。
不多说废话了,直接贴内容吧,用的库的版本基本是最新的了:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>auth0-spring-security-api</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.4.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>elastic.co</id>
<url>https://artifacts.elastic.co/maven</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
这个是今天内部讨论获悉的信息,查了下属实,具体内容可以看官方文档:
5.x以前的multiple types还可以正常工作,但是6.x里面新创建的index只允许一个type了,从7.0开始将强制只有一个type。
这个对于很多打算把ElasticSearch做数据库使用的团队来讲不会是个特别好的消息,因为数据库的很多表其实只有很少的数据,大量数据可能集中在几个大表里面。不过既然趋势如此,如果打算继续用ElasticSearch就必须接受这个变化并遵循。
想想从ElasticSearch 0.9开始用到现在,也就短短5年(已经5年了😯)吧,版本也是一路突飞猛进,到现在6.3,估计7.0也会在年内发布,感受到ElasticSearch的高度活跃,推出的功能也是越来越多,我们原来基于ElasticSearch做的那些功能现在看起来太落伍了,刚好产品也进入维护模式了,估计要重新做了,刚好我原来对这个产品的很多设计非常不满(不是我设计的😛)
不过我的一些想法倒还没有落伍,因为涉及到专利,也不好说太多。
© 2025 解惑
本主题由Anders Noren提供 — 向上 ↑