Przeglądaj źródła

Removing request parameters in _analyze API

Remove unused imports
Replace POST method by GET method in docs
 Add breaking changes explanation
 Fix small issue in Kuromoji docs

Closes #20246
Jun Ohtani 9 lat temu
rodzic
commit
eca9894c5f

+ 0 - 2
core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java

@@ -22,13 +22,11 @@ import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest;
 import org.elasticsearch.client.node.NodeClient;
 import org.elasticsearch.common.ParseField;
 import org.elasticsearch.common.ParseFieldMatcher;
-import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.bytes.BytesReference;
 import org.elasticsearch.common.inject.Inject;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.xcontent.XContentHelper;
 import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.rest.BaseRestHandler;
 import org.elasticsearch.rest.RestController;
 import org.elasticsearch.rest.RestRequest;

+ 0 - 9
core/src/test/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeActionTests.java

@@ -19,25 +19,16 @@
 package org.elasticsearch.rest.action.admin.indices;
 
 import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest;
-import org.elasticsearch.client.node.NodeClient;
 import org.elasticsearch.common.ParseFieldMatcher;
 import org.elasticsearch.common.bytes.BytesArray;
 import org.elasticsearch.common.bytes.BytesReference;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.rest.RestChannel;
-import org.elasticsearch.rest.RestRequest;
 import org.elasticsearch.test.ESTestCase;
-import org.elasticsearch.test.rest.FakeRestRequest;
-
-import java.util.HashMap;
 
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.notNullValue;
 import static org.hamcrest.Matchers.startsWith;
-import static org.mockito.Mockito.doCallRealMethod;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
 
 public class RestAnalyzeActionTests extends ESTestCase {
 

+ 1 - 1
docs/plugins/analysis-icu.asciidoc

@@ -164,7 +164,7 @@ PUT icu_sample
     }
 }
 
-POST icu_sample/_analyze
+GET icu_sample/_analyze
 {
   "analyzer": "my_analyzer",
   "text": "Elasticsearch. Wow!"

+ 11 - 11
docs/plugins/analysis-kuromoji.asciidoc

@@ -175,7 +175,7 @@ PUT kuromoji_sample
   }
 }
 
-POST kuromoji_sample/_analyze
+GET kuromoji_sample/_analyze
 {
   "analyzer": "my_analyzer",
   "text": "東京スカイツリー"
@@ -232,7 +232,7 @@ PUT kuromoji_sample
   }
 }
 
-POST kuromoji_sample/_analyze
+GET kuromoji_sample/_analyze
 {
   "analyzer": "my_analyzer",
   "text": "飲み"
@@ -298,7 +298,7 @@ PUT kuromoji_sample
   }
 }
 
-POST kuromoji_sample/_analyze
+GET kuromoji_sample/_analyze
 {
   "analyzer": "my_analyzer",
   "text": "寿司がおいしいね"
@@ -375,13 +375,13 @@ PUT kuromoji_sample
     }
 }
 
-POST kuromoji_sample/_analyze
+GET kuromoji_sample/_analyze
 {
   "analyzer": "katakana_analyzer",
   "text": "寿司" <1>
 }
 
-POST kuromoji_sample/_analyze
+GET kuromoji_sample/_analyze
 {
   "analyzer": "romaji_analyzer",
   "text": "寿司" <2>
@@ -433,13 +433,13 @@ PUT kuromoji_sample
   }
 }
 
-POST kuromoji_sample/_analyze
+GET kuromoji_sample/_analyze
 {
   "analyzer": "my_analyzer",
   "text": "コピー" <1>
 }
 
-POST kuromoji_sample/_analyze
+GET kuromoji_sample/_analyze
 {
   "analyzer": "my_analyzer",
   "text": "サーバー" <2>
@@ -452,7 +452,7 @@ POST kuromoji_sample/_analyze
 
 
 [[analysis-kuromoji-stop]]
-===== `ja_stop` token filter
+==== `ja_stop` token filter
 
 The `ja_stop` token filter filters out Japanese stopwords (`_japanese_`), and
 any other custom stopwords specified by the user. This filter only supports
@@ -489,7 +489,7 @@ PUT kuromoji_sample
   }
 }
 
-POST kuromoji_sample/_analyze
+GET kuromoji_sample/_analyze
 {
   "analyzer": "analyzer_with_ja_stop",
   "text": "ストップは消える"
@@ -514,7 +514,7 @@ The above request returns:
 // TESTRESPONSE
 
 [[analysis-kuromoji-number]]
-===== `kuromoji_number` token filter
+==== `kuromoji_number` token filter
 
 The `kuromoji_number` token filter normalizes Japanese numbers (kansūji)
 to regular Arabic decimal numbers in half-width characters. For example:
@@ -539,7 +539,7 @@ PUT kuromoji_sample
   }
 }
 
-POST kuromoji_sample/_analyze
+GET kuromoji_sample/_analyze
 {
   "analyzer": "my_analyzer",
   "text": "一〇〇〇"

+ 1 - 1
docs/plugins/analysis-phonetic.asciidoc

@@ -82,7 +82,7 @@ PUT phonetic_sample
   }
 }
 
-POST phonetic_sample/_analyze
+GET phonetic_sample/_analyze
 {
   "analyzer": "my_analyzer",
   "text": "Joe Bloggs" <1>

+ 4 - 0
docs/reference/migration/migrate_6_0/rest.asciidoc

@@ -7,3 +7,7 @@ In previous versions of Elasticsearch, JSON documents were allowed to contain un
 This feature was removed in the 5.x series, but a backwards-compability layer was added via the
 system property `elasticsearch.json.allow_unquoted_field_names`. This backwards-compability layer
 has been removed in Elasticsearch 6.0.0.
+
+==== Analyze API changes
+
+The deprecated request parameters and plain text in request body has been removed, use JSON in request body.