private Client client;
private Node node;
protected final Profiling profiling;
- private final Profiling.Level profilingLevel;
-
public ESNode(Settings settings) {
this(settings, DEFAULT_HEALTH_TIMEOUT);
this.settings = settings;
this.healthTimeout = healthTimeout;
this.profiling = new Profiling(settings);
- String settingsValue = settings.getString(Profiling.CONFIG_PROFILING_LEVEL);
- this.profilingLevel = Profiling.Level.fromConfigString(settingsValue);
}
@Override
esSettings
.put("index.mapper.dynamic", false)
- // Sortable text analyzer
+ // Sortable text analyzer
.put("index.analysis.analyzer.sortable.type", "custom")
.put("index.analysis.analyzer.sortable.tokenizer", "keyword")
.putArray("index.analysis.analyzer.sortable.filter", "trim", "lowercase", "truncate")
- // Edge NGram index-analyzer
+ // Edge NGram index-analyzer
.put("index.analysis.analyzer.index_grams.type", "custom")
.put("index.analysis.analyzer.index_grams.tokenizer", "whitespace")
.putArray("index.analysis.analyzer.index_grams.filter", "trim", "lowercase", "gram_filter")
- // Edge NGram search-analyzer
+ // Edge NGram search-analyzer
.put("index.analysis.analyzer.search_grams.type", "custom")
.put("index.analysis.analyzer.search_grams.tokenizer", "whitespace")
.putArray("index.analysis.analyzer.search_grams.filter", "trim", "lowercase")
- // Word index-analyzer
+ // Word index-analyzer
.put("index.analysis.analyzer.index_words.type", "custom")
.put("index.analysis.analyzer.index_words.tokenizer", "standard")
.putArray("index.analysis.analyzer.index_words.filter",
"standard", "word_filter", "lowercase", "stop", "asciifolding", "porter_stem")
- // Word search-analyzer
+ // Word search-analyzer
.put("index.analysis.analyzer.search_words.type", "custom")
.put("index.analysis.analyzer.search_words.tokenizer", "standard")
.putArray("index.analysis.analyzer.search_words.filter",
"standard", "lowercase", "stop", "asciifolding", "porter_stem")
- // Edge NGram filter
+ // Edge NGram filter
.put("index.analysis.filter.gram_filter.type", "edgeNGram")
.put("index.analysis.filter.gram_filter.min_gram", 2)
.put("index.analysis.filter.gram_filter.max_gram", 15)
.putArray("index.analysis.filter.gram_filter.token_chars", "letter", "digit", "punctuation", "symbol")
- // Word filter
+ // Word filter
.put("index.analysis.filter.word_filter.type", "word_delimiter")
.put("index.analysis.filter.word_filter.generate_word_parts", true)
.put("index.analysis.filter.word_filter.catenate_words", true)
.put("index.analysis.filter.word_filter.split_on_numerics", true)
.put("index.analysis.filter.word_filter.stem_english_possessive", true)
- // Path Analyzer
+ // Path Analyzer
.put("index.analysis.analyzer.path_analyzer.type", "custom")
.put("index.analysis.analyzer.path_analyzer.tokenizer", "path_hierarchy");
}
public <K extends ActionResponse> K execute(ActionRequestBuilder action) {
- StopWatch requestProfile = null;
- if (profilingLevel.ordinal() >= Profiling.Level.BASIC.ordinal()) {
- requestProfile = profiling.start("search", Profiling.Level.BASIC);
- }
+ StopWatch requestProfile = profiling.start("search", Profiling.Level.BASIC);
ListenableActionFuture acc = action.execute();
try {
K response = (K) acc.get();
throw new IllegalStateException("ES error: ", e);
} finally {
if (requestProfile != null) {
- requestProfile.stop(action.toString());
+ requestProfile.stop("Requested: ", action);
}
}
}