19
19
package org .elasticsearch .rest .action .admin .indices ;
20
20
21
21
import org .elasticsearch .action .admin .indices .analyze .AnalyzeRequest ;
22
- import org .elasticsearch .common .ParseFieldMatcher ;
23
22
import org .elasticsearch .common .bytes .BytesArray ;
24
23
import org .elasticsearch .common .settings .Settings ;
25
24
import org .elasticsearch .common .xcontent .XContentFactory ;
@@ -46,7 +45,7 @@ public void testParseXContentForAnalyzeRequest() throws Exception {
46
45
47
46
AnalyzeRequest analyzeRequest = new AnalyzeRequest ("for test" );
48
47
49
- RestAnalyzeAction .buildFromContent (content , analyzeRequest , new ParseFieldMatcher ( Settings . EMPTY ) );
48
+ RestAnalyzeAction .buildFromContent (content , analyzeRequest );
50
49
51
50
assertThat (analyzeRequest .text ().length , equalTo (1 ));
52
51
assertThat (analyzeRequest .text (), equalTo (new String []{"THIS IS A TEST" }));
@@ -79,7 +78,7 @@ public void testParseXContentForAnalyzeRequestWithCustomFilters() throws Excepti
79
78
80
79
AnalyzeRequest analyzeRequest = new AnalyzeRequest ("for test" );
81
80
82
- RestAnalyzeAction .buildFromContent (content , analyzeRequest , new ParseFieldMatcher ( Settings . EMPTY ) );
81
+ RestAnalyzeAction .buildFromContent (content , analyzeRequest );
83
82
84
83
assertThat (analyzeRequest .text ().length , equalTo (1 ));
85
84
assertThat (analyzeRequest .text (), equalTo (new String []{"THIS IS A TEST" }));
@@ -106,7 +105,7 @@ public void testParseXContentForAnalyzeRequestWithUnknownParamThrowsException()
106
105
.field ("unknown" , "keyword" )
107
106
.endObject ());
108
107
IllegalArgumentException e = expectThrows (IllegalArgumentException .class ,
109
- () -> RestAnalyzeAction .buildFromContent (invalidContent , analyzeRequest , new ParseFieldMatcher ( Settings . EMPTY ) ));
108
+ () -> RestAnalyzeAction .buildFromContent (invalidContent , analyzeRequest ));
110
109
assertThat (e .getMessage (), startsWith ("Unknown parameter [unknown]" ));
111
110
}
112
111
@@ -117,7 +116,7 @@ public void testParseXContentForAnalyzeRequestWithInvalidStringExplainParamThrow
117
116
.field ("explain" , "fals" )
118
117
.endObject ());
119
118
IllegalArgumentException e = expectThrows (IllegalArgumentException .class ,
120
- () -> RestAnalyzeAction .buildFromContent (invalidExplain , analyzeRequest , new ParseFieldMatcher ( Settings . EMPTY ) ));
119
+ () -> RestAnalyzeAction .buildFromContent (invalidExplain , analyzeRequest ));
121
120
assertThat (e .getMessage (), startsWith ("explain must be either 'true' or 'false'" ));
122
121
}
123
122
@@ -130,7 +129,7 @@ public void testDeprecatedParamIn2xException() throws Exception {
130
129
.array ("filters" , "lowercase" )
131
130
.endObject ());
132
131
IllegalArgumentException e = expectThrows (IllegalArgumentException .class , () -> RestAnalyzeAction .buildFromContent (parser ,
133
- new AnalyzeRequest ("for test" ), new ParseFieldMatcher ( Settings . EMPTY ) ));
132
+ new AnalyzeRequest ("for test" )));
134
133
assertThat (e .getMessage (), startsWith ("Unknown parameter [filters]" ));
135
134
}
136
135
@@ -142,7 +141,7 @@ public void testDeprecatedParamIn2xException() throws Exception {
142
141
.array ("token_filters" , "lowercase" )
143
142
.endObject ());
144
143
IllegalArgumentException e = expectThrows (IllegalArgumentException .class , () -> RestAnalyzeAction .buildFromContent (parser ,
145
- new AnalyzeRequest ("for test" ), new ParseFieldMatcher ( Settings . EMPTY ) ));
144
+ new AnalyzeRequest ("for test" )));
146
145
assertThat (e .getMessage (), startsWith ("Unknown parameter [token_filters]" ));
147
146
}
148
147
@@ -154,7 +153,7 @@ public void testDeprecatedParamIn2xException() throws Exception {
154
153
.array ("char_filters" , "lowercase" )
155
154
.endObject ());
156
155
IllegalArgumentException e = expectThrows (IllegalArgumentException .class , () -> RestAnalyzeAction .buildFromContent (parser ,
157
- new AnalyzeRequest ("for test" ), new ParseFieldMatcher ( Settings . EMPTY ) ));
156
+ new AnalyzeRequest ("for test" )));
158
157
assertThat (e .getMessage (), startsWith ("Unknown parameter [char_filters]" ));
159
158
}
160
159
@@ -166,7 +165,7 @@ public void testDeprecatedParamIn2xException() throws Exception {
166
165
.array ("token_filter" , "lowercase" )
167
166
.endObject ());
168
167
IllegalArgumentException e = expectThrows (IllegalArgumentException .class , () -> RestAnalyzeAction .buildFromContent (parser ,
169
- new AnalyzeRequest ("for test" ), new ParseFieldMatcher ( Settings . EMPTY ) ));
168
+ new AnalyzeRequest ("for test" )));
170
169
assertThat (e .getMessage (), startsWith ("Unknown parameter [token_filter]" ));
171
170
}
172
171
}
0 commit comments