Package org.elasticsearch.search.facet

Examples of org.elasticsearch.search.facet.FacetPhaseExecutionException


    private LongArrayIndexFieldData getKeyFieldData(final String facetName, final String fieldName, final SearchContext context) {
        if(fieldName != null) {
            final FieldMapper<?> mapper = context.smartNameFieldMapper(fieldName);
            if(mapper == null) {
                throw new FacetPhaseExecutionException(facetName, "no mapping found for " + fieldName);
            }
            if(!"long".equals(mapper.fieldDataType().getType())) {
                throw new FacetPhaseExecutionException(facetName, "key field " + fieldName + " is not of type long");
            }
            return context.fieldData().getForField(mapper);
        }
        else
            throw new FacetPhaseExecutionException(facetName, "[key_field] is required to be set for date facet");
    }
View Full Code Here


                _collector = new SlicedCollector(keyFieldData, valueFieldData, sliceFieldData, tzRounding);
        else if(sliceFieldData == null)
            if(valueFieldData == null)
                _collector = new DistinctCollector(keyFieldData, distinctFieldData, tzRounding, exactThreshold);
            else
                throw new FacetPhaseExecutionException("unknown date_facet", "Can't use distinct_field and value_field together");
        else if(valueFieldData == null)
            _collector = new SlicedDistinctCollector(keyFieldData, sliceFieldData, distinctFieldData, tzRounding, exactThreshold);
        else
            throw new FacetPhaseExecutionException("unknown date_facet", "Can't use distinct_field and value_field together");
    }
View Full Code Here

        private final boolean _numericField;
        FIELD_DATA_TYPE _type;

        public PostExecutor(final String fieldName, final boolean numericField, final FIELD_DATA_TYPE type) {
            if(_sampleRate != 1.0){
                throw new FacetPhaseExecutionException(_facetName, "[sample] is not supported in post mode");
            }
            _fieldName = fieldName;
            _numericField = numericField;
            _type = type;
        }
View Full Code Here

            }
        }

        if(sample <= 0 || sample > 1)
            throw new FacetPhaseExecutionException(facetName, "[sample] must be greater than 0 and less than or equal to 1");

        if(keyField == null) {
            throw new FacetPhaseExecutionException(facetName, "key field is required to be set for term list facet, either using [field] or using [key_field]");
        }

        final FieldMapper<?> mapper = context.smartNameFieldMapper(keyField);
        if(mapper == null) {
            throw new FacetPhaseExecutionException(facetName, "(key) field [" + keyField + "] not found");
        }

        final IndexFieldData<?> indexFieldData = context.fieldData().getForField(mapper);

        return new TermListFacetExecutor(context, indexFieldData, facetName, maxPerShard, sample);
View Full Code Here

        }
      }
    }

    if (factor < 0.0 || factor > 1.0) {
      throw new FacetPhaseExecutionException(facetName, "value [" + factor + "] is not in range [0.0, 1.0]");
    }
    FieldMapper<?> fieldMapper = context.smartNameFieldMapper(fieldName);
        if (fieldMapper == null) {
            throw new FacetPhaseExecutionException(facetName, "failed to find mapping for [" + fieldName + "]");
        }
        IndexGeoPointFieldData<?> indexFieldData = context.fieldData().getForField(fieldMapper);
    return new GeoClusterFacetExecutor(indexFieldData, factor);
  }
View Full Code Here

TOP

Related Classes of org.elasticsearch.search.facet.FacetPhaseExecutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.