我正在使用jest客户端分析功能来分析文本。我使用的是Jest客户端版本5.3.4和ES 6.5.4。这是代码:
Analyze.Builder AnalyzeBuilder = new Analyze.Builder().index(index.name).text(textToAnalyze).analyzer(analyzer);
JestResult jestResult = null;
JestClient client = getClient(index.cluster); // fetches client from the pool
Analyze analyze = AnalyzeBuilder.build();
System.out.println(analyze.toString());
jestResult = client.execute(analyze);
System.out.println(jestResult.getJsonString());
assertNotNull(jestResult);
assertTrue(jestResult.isSucceeded());
它返回以下响应:
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"request [/mytest-ff3f0473-e20e-4926-b983-4cf466b0b397/_analyze] contains unrecognized parameter: [analyzer]"}],"type":"illegal_argument_exception","reason":"request [/mytest-ff3f0473-e20e-4926-b983-4cf466b0b397/_analyze] contains unrecognized parameter: [analyzer]"},"status":400}
这是“analyze”变量的toString输出。
Analyze{uri=mytest-ff3f0473-e20e-4926-b983-4cf466b0b397/_analyze?analyzer=multilingual_english, method=POST}
看来查询字符串中的“analyzer”参数不再有效。它在JSON中发送时有效。下面的查询工作。
{"analyzer" : "standard", "text" : "while processing data"}
有没有办法强制JestClient在JSON中发送分析器参数?
我联系了searchly.com支持团队。他们的回答是,JestClient 5.3.4可能无法与ES 6.5.3一起使用,并建议使用最新版本6.3.1。
我尝试过,JestClient 6.3.1适用于ElasticSearch 6.5.4。
谢谢