本文整理汇总了Java中org.elasticsearch.common.xcontent.support.XContentMapValues.nodeDoubleValue方法的典型用法代码示例。如果您正苦于以下问题:Java XContentMapValues.nodeDoubleValue方法的具体用法?Java XContentMapValues.nodeDoubleValue怎么用?Java XContentMapValues.nodeDoubleValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.common.xcontent.support.XContentMapValues
的用法示例。
在下文中一共展示了XContentMapValues.nodeDoubleValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@Override
public Mapper.Builder parse(String fieldName, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
TextFieldMapper.Builder builder = new TextFieldMapper.Builder(fieldName);
builder.fieldType().setIndexAnalyzer(parserContext.getIndexAnalyzers().getDefaultIndexAnalyzer());
builder.fieldType().setSearchAnalyzer(parserContext.getIndexAnalyzers().getDefaultSearchAnalyzer());
builder.fieldType().setSearchQuoteAnalyzer(parserContext.getIndexAnalyzers().getDefaultSearchQuoteAnalyzer());
parseTextField(builder, fieldName, node, parserContext);
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
Map.Entry<String, Object> entry = iterator.next();
String propName = entry.getKey();
Object propNode = entry.getValue();
if (propName.equals("position_increment_gap")) {
int newPositionIncrementGap = XContentMapValues.nodeIntegerValue(propNode, -1);
builder.positionIncrementGap(newPositionIncrementGap);
iterator.remove();
} else if (propName.equals("fielddata")) {
builder.fielddata(XContentMapValues.nodeBooleanValue(propNode, "fielddata"));
iterator.remove();
} else if (propName.equals("eager_global_ordinals")) {
builder.eagerGlobalOrdinals(XContentMapValues.nodeBooleanValue(propNode, "eager_global_ordinals"));
iterator.remove();
} else if (propName.equals("fielddata_frequency_filter")) {
Map<?,?> frequencyFilter = (Map<?, ?>) propNode;
double minFrequency = XContentMapValues.nodeDoubleValue(frequencyFilter.remove("min"), 0);
double maxFrequency = XContentMapValues.nodeDoubleValue(frequencyFilter.remove("max"), Integer.MAX_VALUE);
int minSegmentSize = XContentMapValues.nodeIntegerValue(frequencyFilter.remove("min_segment_size"), 0);
builder.fielddataFrequencyFilter(minFrequency, maxFrequency, minSegmentSize);
DocumentMapperParser.checkNoRemainingFields(propName, frequencyFilter, parserContext.indexVersionCreated());
iterator.remove();
}
}
return builder;
}
示例2: parse
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@Override
public Mapper.Builder parse(final String fieldName, final Map<String, Object> node, final ParserContext parserContext) throws MapperParsingException {
final LangStringFieldMapper.Builder builder = new LangStringFieldMapper.Builder(fieldName);
builder.fieldType().setIndexAnalyzer(parserContext.getIndexAnalyzers().getDefaultIndexAnalyzer());
builder.fieldType().setSearchAnalyzer(parserContext.getIndexAnalyzers().getDefaultSearchAnalyzer());
builder.fieldType().setSearchQuoteAnalyzer(parserContext.getIndexAnalyzers().getDefaultSearchQuoteAnalyzer());
parseTextField(builder, fieldName, node, parserContext);
for (final Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
final Map.Entry<String, Object> entry = iterator.next();
final String propName = entry.getKey();
final Object propNode = entry.getValue();
if (propName.equals("position_increment_gap")) {
final int newPositionIncrementGap = XContentMapValues.nodeIntegerValue(propNode, -1);
builder.positionIncrementGap(newPositionIncrementGap);
iterator.remove();
} else if (propName.equals("fielddata")) {
builder.fielddata(XContentMapValues.nodeBooleanValue(propNode, "fielddata"));
iterator.remove();
} else if (propName.equals("eager_global_ordinals")) {
builder.eagerGlobalOrdinals(XContentMapValues.nodeBooleanValue(propNode, "eager_global_ordinals"));
iterator.remove();
} else if (propName.equals("fielddata_frequency_filter")) {
final Map<?,?> frequencyFilter = (Map<?, ?>) propNode;
final double minFrequency = XContentMapValues.nodeDoubleValue(frequencyFilter.remove("min"), 0);
final double maxFrequency = XContentMapValues.nodeDoubleValue(frequencyFilter.remove("max"), Integer.MAX_VALUE);
final int minSegmentSize = XContentMapValues.nodeIntegerValue(frequencyFilter.remove("min_segment_size"), 0);
builder.fielddataFrequencyFilter(minFrequency, maxFrequency, minSegmentSize);
DocumentMapperParser.checkNoRemainingFields(propName, frequencyFilter, parserContext.indexVersionCreated());
iterator.remove();
} else if (propName.equals(SEPARATOR_SETTING_KEY)) {
builder.fieldSeparator(propNode.toString());
iterator.remove();
} else if (propName.equals(LANG_SETTING_KEY)) {
builder.supportedLanguages(
XContentMapValues.nodeStringArrayValue(propNode));
iterator.remove();
} else if (propName.equals(LANG_FIELD_SETTING_KEY)) {
builder.langField(propNode.toString());
iterator.remove();
} else if (propName.equals(LANG_BASE_NAME_SETTING_KEY)) {
builder.langBaseName(propNode.toString());
iterator.remove();
}
}
return builder;
}
示例3: S3River
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@Inject
@SuppressWarnings({ "unchecked" })
protected S3River(RiverName riverName, RiverSettings settings, Client client, ThreadPool threadPool) throws Exception{
super(riverName, settings);
this.client = client;
this.threadPool = threadPool;
this.riverStatus = RiverStatus.UNKNOWN;
// Deal with connector settings.
if (settings.settings().containsKey("amazon-s3")){
Map<String, Object> feed = (Map<String, Object>)settings.settings().get("amazon-s3");
// Retrieve feed settings.
String feedname = XContentMapValues.nodeStringValue(feed.get("name"), null);
String bucket = XContentMapValues.nodeStringValue(feed.get("bucket"), null);
String pathPrefix = XContentMapValues.nodeStringValue(feed.get("pathPrefix"), null);
String downloadHost = XContentMapValues.nodeStringValue(feed.get("download_host"), null);
int updateRate = XContentMapValues.nodeIntegerValue(feed.get("update_rate"), 15 * 60 * 1000);
boolean jsonSupport = XContentMapValues.nodeBooleanValue(feed.get("json_support"), false);
double indexedCharsRatio = XContentMapValues.nodeDoubleValue(feed.get("indexed_chars_ratio"), 0.0);
String[] includes = S3RiverUtil.buildArrayFromSettings(settings.settings(), "amazon-s3.includes");
String[] excludes = S3RiverUtil.buildArrayFromSettings(settings.settings(), "amazon-s3.excludes");
// Retrieve connection settings.
String accessKey = XContentMapValues.nodeStringValue(feed.get("accessKey"), null);
String secretKey = XContentMapValues.nodeStringValue(feed.get("secretKey"), null);
boolean useIAMRoleForEC2 = XContentMapValues.nodeBooleanValue(feed.get("use_EC2_IAM"), false);
feedDefinition = new S3RiverFeedDefinition(feedname, bucket, pathPrefix, downloadHost,
updateRate, Arrays.asList(includes), Arrays.asList(excludes), accessKey, secretKey, useIAMRoleForEC2,
jsonSupport, indexedCharsRatio);
} else {
logger.error("You didn't define the amazon-s3 settings. Exiting... See https://github.com/lbroudoux/es-amazon-s3-river");
indexName = null;
typeName = null;
bulkSize = 100;
feedDefinition = null;
s3 = null;
return;
}
// Deal with index settings if provided.
if (settings.settings().containsKey("index")) {
Map<String, Object> indexSettings = (Map<String, Object>)settings.settings().get("index");
indexName = XContentMapValues.nodeStringValue(indexSettings.get("index"), riverName.name());
typeName = XContentMapValues.nodeStringValue(indexSettings.get("type"), S3RiverUtil.INDEX_TYPE_DOC);
bulkSize = XContentMapValues.nodeIntegerValue(indexSettings.get("bulk_size"), 100);
} else {
indexName = riverName.name();
typeName = S3RiverUtil.INDEX_TYPE_DOC;
bulkSize = 100;
}
// We need to connect to Amazon S3 after ensure mandatory settings are here.
if (feedDefinition.getBucket() == null){
logger.error("Amazon S3 bucket should not be null. Please fix this.");
throw new IllegalArgumentException("Amazon S3 bucket should not be null.");
}
// Connect using the appropriate authentication process.
if (feedDefinition.getAccessKey() == null && feedDefinition.getSecretKey() == null) {
s3 = new S3Connector(feedDefinition.isUseIAMRoleForEC2());
} else {
s3 = new S3Connector(feedDefinition.getAccessKey(), feedDefinition.getSecretKey());
}
try {
s3.connectUserBucket(feedDefinition.getBucket(), feedDefinition.getPathPrefix());
} catch (AmazonS3Exception ase){
logger.error("Exception while connecting Amazon S3 user bucket. "
+ "Either access key, secret key, IAM Role or bucket name are incorrect");
throw ase;
}
this.riverStatus = RiverStatus.INITIALIZED;
}