37
37
import org .elasticsearch .cluster .metadata .IndexMetaData ;
38
38
import org .elasticsearch .common .settings .Settings ;
39
39
import org .elasticsearch .env .Environment ;
40
- import org .elasticsearch .env .TestEnvironment ;
41
40
import org .elasticsearch .index .Index ;
42
41
import org .elasticsearch .index .analysis .AnalysisRegistry ;
43
42
import org .elasticsearch .index .analysis .TokenizerFactory ;
@@ -97,7 +96,7 @@ public void tokenizerWithAdditionalSettings() throws IOException {
97
96
public void analyzerProvider () throws IOException {
98
97
Settings indexSettings = Settings .builder ().put (IndexMetaData .SETTING_VERSION_CREATED , Version .CURRENT ).build ();
99
98
Settings nodeSettings = Settings .builder ().put (Environment .PATH_HOME_SETTING .getKey (), testFolder .getRoot ().getPath ()).build ();
100
- Environment env = TestEnvironment . newEnvironment (nodeSettings );
99
+ Environment env = new Environment (nodeSettings );
101
100
Settings settings = Settings .builder ().put ("settings_path" , "sudachi/sudachi.json" ).build ();
102
101
SudachiAnalyzerProvider provider = new SudachiAnalyzerProvider (IndexSettingsModule .newIndexSettings (new Index ("test" , "_na_" ), indexSettings ), env , "sudachi" , settings );
103
102
try (TokenStream stream = provider .get ().tokenStream ("_na_" , "東京へ行く。" )) {
@@ -111,7 +110,7 @@ Map<String, TokenizerFactory> createTestTokenizers(Map<String, String> settings)
111
110
builder .put (IndexMetaData .SETTING_VERSION_CREATED , Version .CURRENT );
112
111
Settings indexSettings = builder .build ();
113
112
Settings nodeSettings = Settings .builder ().put (Environment .PATH_HOME_SETTING .getKey (), testFolder .getRoot ().getPath ()).build ();
114
- Environment env = TestEnvironment . newEnvironment (nodeSettings );
113
+ Environment env = new Environment (nodeSettings );
115
114
AnalysisModule analysisModule = new AnalysisModule (env , Collections .singletonList (new AnalysisSudachiPlugin ()));
116
115
AnalysisRegistry analysisRegistry = analysisModule .getAnalysisRegistry ();
117
116
return analysisRegistry .buildTokenizerFactories (IndexSettingsModule .newIndexSettings (new Index ("test" , "_na_" ), indexSettings ));
0 commit comments