fieldNames = new HashSet<String>(); fieldNames.add(x.mapper().names().indexName()); } else { if (extractFieldNames == null) {
if (fieldMapper != null) { Map<String, Object> mapper = new HashMap(); mapper.put("fullName", fieldMapper.names().fullName()); mapper.put("indexName", fieldMapper.names().indexName()); mapper.put("indexNameClean", fieldMapper.names().indexNameClean());
this.indexFieldName = smartMappers.mapper().names().indexName(); this.fieldDataType = smartMappers.mapper().fieldDataType();
fieldNames = new HashSet<String>(); fieldNames.add(x.mapper().names().indexName()); } else { if (extractFieldNames == null) {
public FacetedDateHistogramCollector(String facetName, String keyFieldName, TimeZoneRounding tzRounding, FacetProcessor internalProcessor, byte[] internalFacetConfig, SearchContext context) throws IOException { super(facetName); this.fieldDataCache = context.fieldDataCache(); this.keyFieldName = keyFieldName; MapperService.SmartNameFieldMappers smartMappers = context .smartFieldMappers(keyFieldName); if (smartMappers == null || !smartMappers.hasMapper()) { throw new FacetPhaseExecutionException(facetName, "No mapping found for field [" + keyFieldName + "]"); } // add type filter if there is exact doc mapper associated with it if (smartMappers.explicitTypeInNameWithDocMapper()) { setFilter(context.filterCache().cache( smartMappers.docMapper().typeFilter())); } keyIndexFieldName = smartMappers.mapper().names().indexName(); keyFieldDataType = smartMappers.mapper().fieldDataType(); InternalCollectorFactory colFactory= new InternalCollectorFactory(facetName, internalProcessor, internalFacetConfig, context); logger.debug("Facet {}: Test running internal facet processor ", facetName); this.internalExampleCollector = colFactory.createInternalCollector(); this.histoProc = new DateHistogramProc(facetName,tzRounding,colFactory); }
@Override protected CacheStatsPerFieldStats nodeOperation(CacheStatsPerFieldStatsRequest nodeStatsRequest) throws ElasticSearchException { List<CacheStatsPerFieldStats.FieldEntry> entries = Lists.newArrayList(); for (IndexService indexService : indicesService) { logger.debug("Starting to analyze index {}",indexService.settingsService().index().name()); FieldDataCache fieldData = indexService.cache().fieldData(); for (DocumentMapper mapper : indexService.mapperService()) { for (FieldMapper fieldMapper : mapper.mappers()) { String field = fieldMapper.names().indexName(); logger.debug("Calculating size for field {}",field); long size = fieldData.sizeInBytes(field); if (size > 0) { logger.debug("Size for field {}: {}",field,size); entries.add(new CacheStatsPerFieldStats.FieldEntry(field,size)); } else logger.debug("Field {} is has no cache. Skipping.",field); } } } return new CacheStatsPerFieldStats(clusterService.localNode(),hostname, System.currentTimeMillis(),entries); }
@Override public Post post() { // TODO would we need to implement filtering separately at this stage? From SearchContext? //check the data type of the field //if it is numeric, get the type and pass the information to the PostExecutor //otherwise, handle strings final boolean numericField = (_indexFieldData instanceof IndexNumericFieldData); FIELD_DATA_TYPE type = FIELD_DATA_TYPE.STRING; if(numericField) { final IndexNumericFieldData<?> indexNumericFieldData = (IndexNumericFieldData<?>) _indexFieldData; if(indexNumericFieldData.getNumericType() == IndexNumericFieldData.NumericType.LONG) type = FIELD_DATA_TYPE.LONG; if(indexNumericFieldData.getNumericType() == IndexNumericFieldData.NumericType.INT) type = FIELD_DATA_TYPE.INT; } return new PostExecutor(_indexFieldData.getFieldNames().name(), numericField, type); //throw new UnsupportedOperationException("Post aggregation is not yet supported"); }
protected SirenFieldMapper(String name, FieldType fieldType, NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer, boolean enabled, boolean autoBoost, PostingsFormatProvider postingsProvider, DocValuesFormatProvider docValuesProvider, SimilarityProvider similarity, Loading normsLoading, @Nullable Settings fieldDataSettings, Settings indexSettings) { super(new Names(name, name, name, name), 1.0f, fieldType, null, indexAnalyzer, searchAnalyzer, postingsProvider, docValuesProvider, similarity, normsLoading, fieldDataSettings, indexSettings); }