add clear when deleting an index for the field data service
This commit is contained in:
parent
a39ca58de9
commit
692413862a
|
@ -43,6 +43,7 @@ import org.elasticsearch.index.codec.CodecModule;
|
||||||
import org.elasticsearch.index.engine.IndexEngine;
|
import org.elasticsearch.index.engine.IndexEngine;
|
||||||
import org.elasticsearch.index.engine.IndexEngineModule;
|
import org.elasticsearch.index.engine.IndexEngineModule;
|
||||||
import org.elasticsearch.index.fielddata.IndexFieldDataModule;
|
import org.elasticsearch.index.fielddata.IndexFieldDataModule;
|
||||||
|
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
||||||
import org.elasticsearch.index.flush.FlushStats;
|
import org.elasticsearch.index.flush.FlushStats;
|
||||||
import org.elasticsearch.index.gateway.IndexGateway;
|
import org.elasticsearch.index.gateway.IndexGateway;
|
||||||
import org.elasticsearch.index.gateway.IndexGatewayModule;
|
import org.elasticsearch.index.gateway.IndexGatewayModule;
|
||||||
|
@ -346,6 +347,7 @@ public class InternalIndicesService extends AbstractLifecycleComponent<IndicesSe
|
||||||
|
|
||||||
indexInjector.getInstance(PercolatorService.class).close();
|
indexInjector.getInstance(PercolatorService.class).close();
|
||||||
indexInjector.getInstance(IndexCache.class).close();
|
indexInjector.getInstance(IndexCache.class).close();
|
||||||
|
indexInjector.getInstance(IndexFieldDataService.class).clear();
|
||||||
indexInjector.getInstance(AnalysisService.class).close();
|
indexInjector.getInstance(AnalysisService.class).close();
|
||||||
indexInjector.getInstance(IndexEngine.class).close();
|
indexInjector.getInstance(IndexEngine.class).close();
|
||||||
indexInjector.getInstance(IndexServiceManagement.class).close();
|
indexInjector.getInstance(IndexServiceManagement.class).close();
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.common.component.AbstractComponent;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
|
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
||||||
import org.elasticsearch.index.mapper.FieldMapper;
|
import org.elasticsearch.index.mapper.FieldMapper;
|
||||||
import org.elasticsearch.search.facet.Facet;
|
import org.elasticsearch.search.facet.Facet;
|
||||||
import org.elasticsearch.search.facet.FacetCollector;
|
import org.elasticsearch.search.facet.FacetCollector;
|
||||||
|
@ -119,22 +120,6 @@ public class RangeFacetProcessor extends AbstractComponent implements FacetProce
|
||||||
|
|
||||||
RangeFacet.Entry[] rangeEntries = entries.toArray(new RangeFacet.Entry[entries.size()]);
|
RangeFacet.Entry[] rangeEntries = entries.toArray(new RangeFacet.Entry[entries.size()]);
|
||||||
|
|
||||||
// fix the range entries if needed
|
|
||||||
if (keyField != null) {
|
|
||||||
FieldMapper mapper = context.smartNameFieldMapper(keyField);
|
|
||||||
if (mapper == null) {
|
|
||||||
throw new FacetPhaseExecutionException(facetName, "No mapping found for key_field [" + keyField + "]");
|
|
||||||
}
|
|
||||||
for (RangeFacet.Entry entry : rangeEntries) {
|
|
||||||
if (entry.fromAsString != null) {
|
|
||||||
entry.from = ((Number) mapper.value(entry.fromAsString)).doubleValue();
|
|
||||||
}
|
|
||||||
if (entry.toAsString != null) {
|
|
||||||
entry.to = ((Number) mapper.value(entry.toAsString)).doubleValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keyScript != null && valueScript != null) {
|
if (keyScript != null && valueScript != null) {
|
||||||
return new ScriptRangeFacetCollector(facetName, scriptLang, keyScript, valueScript, params, rangeEntries, context);
|
return new ScriptRangeFacetCollector(facetName, scriptLang, keyScript, valueScript, params, rangeEntries, context);
|
||||||
}
|
}
|
||||||
|
@ -143,6 +128,22 @@ public class RangeFacetProcessor extends AbstractComponent implements FacetProce
|
||||||
throw new FacetPhaseExecutionException(facetName, "key field is required to be set for range facet, either using [field] or using [key_field]");
|
throw new FacetPhaseExecutionException(facetName, "key field is required to be set for range facet, either using [field] or using [key_field]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we have a keyField
|
||||||
|
FieldMapper keyFieldMapper = context.smartNameFieldMapper(keyField);
|
||||||
|
if (keyFieldMapper == null) {
|
||||||
|
throw new FacetPhaseExecutionException(facetName, "No mapping found for key_field [" + keyField + "]");
|
||||||
|
}
|
||||||
|
for (RangeFacet.Entry entry : rangeEntries) {
|
||||||
|
if (entry.fromAsString != null) {
|
||||||
|
entry.from = ((Number) keyFieldMapper.value(entry.fromAsString)).doubleValue();
|
||||||
|
}
|
||||||
|
if (entry.toAsString != null) {
|
||||||
|
entry.to = ((Number) keyFieldMapper.value(entry.toAsString)).doubleValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IndexNumericFieldData keyIndexFieldData = context.fieldData().getForField(keyFieldMapper.names(), keyFieldMapper.fieldDataType2());
|
||||||
|
|
||||||
if (valueField == null || keyField.equals(valueField)) {
|
if (valueField == null || keyField.equals(valueField)) {
|
||||||
return new RangeFacetCollector(facetName, keyField, rangeEntries, context);
|
return new RangeFacetCollector(facetName, keyField, rangeEntries, context);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue