当前位置:网站首页>ES:Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes
ES:Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes
2022-07-26 16:34:00 【This square Galaxy】
Cause of occurrence
- Study ES in Java HighLevel Rest Client client API
Running environment
- elasticsearch edition :7.12.1
- jdk edition :jdk-8
- computer system :win10
- Idea edition :2021.2
Error message
org.elasticsearch.common.compress.NotXContentException: Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes
at org.elasticsearch.common.compress.CompressorFactory.compressor(CompressorFactory.java:42)
at org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:108)
at org.elasticsearch.client.indices.CreateIndexRequest.source(CreateIndexRequest.java:276)
at org.elasticsearch.client.indices.CreateIndexRequest.source(CreateIndexRequest.java:257)
at com.linxuan.hotel.HotelDemoApplicationTests.createHotelIndex(HotelDemoApplicationTests.java:33)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at java.util.ArrayList.forEach(ArrayList.java:1249)
Analysis and investigation
- Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes
- Compressor detection can only be performed in certain xcontent Bytes or compressed xcontent Byte above call
The error can be located to HotelDemoApplicationTests.java:33 That's ok , The code is as follows :
@Test
void createHotelIndex() throws IOException {
// 1. establish Request object
CreateIndexRequest request = new CreateIndexRequest("hotel");
// 2. Prepare the requested parameters DSL sentence
// 33 That's ok Report errors
request.source(MAPPING_TEMPLATE, XContentType.JSON);
// 3. Send a request
client.indices().create(request, RequestOptions.DEFAULT);
}
Then you can turn the error information into human words : The type of statement is not JSON Stylized or JSON Format error .
location MAPPING_TEMPLATE, The code is as follows :
public static final String MAPPING_TEMPLATE = "PUT /hotel\n" +
"{\n" +
" \"mappings\": {\n" +
" \"properties\": {\n" +
" \"id\": {\n" +
" \"type\": \"keyword\"\n" +
" },\n" +
" \"name\":{\n" +
" \"type\": \"text\",\n" +
" \"analyzer\": \"ik_max_word\",\n" +
" \"copy_to\": \"all\"\n" +
" },\n" +
" \"address\":{\n" +
" \"type\": \"keyword\",\n" +
" \"index\": false\n" +
" },\n" +
" \"all\":{\n" +
" \"type\": \"text\",\n" +
" \"analyzer\": \"ik_max_word\"\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n";
OK, The reason is found , Because this code is added :"PUT /hotel\n" +. Delete it .
边栏推荐
- 研发效能的道与术 - 道篇
- 综合设计一个OPPE主页--顶部,头部的设计
- Use verdaccio to build your own NPM private library
- SQL statement -- single line comment and multi line comment
- Happy 10th birthday, clojure
- Class initialization mechanism of JVM
- Tdengine landed in GCL energy technology, with tens of billions of data compressed to 600gb
- Technology vane | interpretation of cloud native technology architecture maturity model
- 数字化转型怎么就那么的难?!
- Application of workflow engine in vivo marketing automation
猜你喜欢

PAT甲级 1045 Favorite Color Stripe

Docker install redis? How to configure persistence policy?

Sql语句——单行注释与多行注释

Tao and art of R & D Efficiency - Tao chapter

Vscode batch delete

The difference and efficiency comparison of three methods of C # conversion integer

Internet Protocol

Guetzli simple to use

2022 latest Tibet Construction scaffolder (construction special operation) simulation exam questions and answers

综合设计一个OPPE主页--导航栏的设计
随机推荐
Mapwithstate of spark streaming state flow
FTP protocol
Pat grade a 1046 shortest distance
Modify the password of the root user of MySQL database
ES:Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes
Configmap of kubernetes
[ten thousand words long text] Based on LSM tree thought Net 6.0 C # realize kV database (case version)
Re9:读论文 DEAL Inductive Link Prediction for Nodes Having Only Attribute Information
Build resume editor based on Nocode
量化交易之数字货币篇 - 通过时间戳与方向来合并逐笔成交数据(大单合并)
NUC 11 build esxi 7.0.3f install network card driver-v2 (upgraded version in July 2022)
Collection of open source expert opinions on trusted privacy computing framework "argot"
视频媒介video
Analyzing method and proc in Ruby
修改mysql数据库root用户的密码
Pat grade a 1049 counting ones
Sword finger offer special assault edition day 11
Pat class a 1047 student list for course
Bugku login1
Pat grade a 1050 string subtraction