本文整理汇总了Java中org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue方法的典型用法代码示例。如果您正苦于以下问题:Java XContentMapValues.nodeBooleanValue方法的具体用法?Java XContentMapValues.nodeBooleanValue怎么用?Java XContentMapValues.nodeBooleanValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.common.xcontent.support.XContentMapValues
的用法示例。
在下文中一共展示了XContentMapValues.nodeBooleanValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SnapshotsSettings
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
public SnapshotsSettings(RiverSettings settings) {
super();
if (settings.settings().containsKey(RIVERNAME)) {
@SuppressWarnings({ "unchecked" })
Map<String, Object> snapshotterSettings = (Map<String, Object>) settings.settings().get(RIVERNAME);
this.repository = XContentMapValues.nodeStringValue(snapshotterSettings.get("repository"), "my_backup");
this.indices = XContentMapValues.nodeStringValue(snapshotterSettings.get("indices"), "_all");
this.includeGlobalState = XContentMapValues.nodeBooleanValue(snapshotterSettings.get("include_global_state"), false);
this.frequency = TimeValue.parseTimeValue(XContentMapValues.nodeStringValue(snapshotterSettings.get("frequency"), "24h"), TimeValue.timeValueMinutes(60));
if (snapshotterSettings.get("purgeAfter") != null && snapshotterSettings.get("purgeAfter").toString().length() > 0) {
this.purgeAfter = TimeValue.parseTimeValue(XContentMapValues.nodeStringValue(snapshotterSettings.get("purgeAfter"), "240h"), TimeValue.timeValueHours(240));
} else {
this.purgeAfter = null;
}
this.setPurgeIndicesMustMatch(XContentMapValues.nodeBooleanValue(snapshotterSettings.get("purge_indices_must_match"), true));
} else {
this.repository = "my_backup";
this.indices = "_all";
this.includeGlobalState = false;
this.frequency = TimeValue.timeValueHours(24);
this.purgeAfter = null; // no purging by default
this.setPurgeIndicesMustMatch(true);
}
}
示例2: createRiverContext
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@Override
protected void createRiverContext(String riverType, String riverName, Map<String, Object> mySettings) throws IOException {
super.createRiverContext(riverType, riverName, mySettings);
// defaults for column strategy
String columnCreatedAt = XContentMapValues.nodeStringValue(mySettings.get("created_at"), "created_at");
String columnUpdatedAt = XContentMapValues.nodeStringValue(mySettings.get("updated_at"), "updated_at");
String columnDeletedAt = XContentMapValues.nodeStringValue(mySettings.get("deleted_at"), null);
boolean columnEscape = XContentMapValues.nodeBooleanValue(mySettings.get("column_escape"), true);
TimeValue lastRunTimeStampOverlap = XContentMapValues.nodeTimeValue(mySettings.get("last_run_timestamp_overlap"),
TimeValue.timeValueSeconds(0));
riverContext
.columnCreatedAt(columnCreatedAt)
.columnUpdatedAt(columnUpdatedAt)
.columnDeletedAt(columnDeletedAt)
.columnEscape(columnEscape)
.setLastRunTimeStampOverlap(lastRunTimeStampOverlap);
}
示例3: nodeBooleanValue
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
public static boolean nodeBooleanValue(String fieldName, String propertyName, Object node,
Mapper.TypeParser.ParserContext parserContext) {
if (parserContext.indexVersionCreated().onOrAfter(Version.V_6_0_0_alpha1_UNRELEASED)) {
return XContentMapValues.nodeBooleanValue(node, fieldName + "." + propertyName);
} else {
return nodeBooleanValueLenient(fieldName, propertyName, node);
}
}
示例4: ComputedFieldRootMapper
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
protected ComputedFieldRootMapper(String name, Map<String, Object> mappings)
{
_logger = Loggers.getLogger("computed-fields", SettingsHelper.GetSettings(), name);
_name = name;
_mappings = mappings;
_enabled = XContentMapValues.nodeBooleanValue(mappings.get("enabled"), false);
}
示例5: parse
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@Override
public Mapper.Builder<?, ?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
Builder builder;
if (parserContext.indexVersionCreated().before(Version.V_2_2_0)) {
builder = new GeoPointFieldMapperLegacy.Builder(name);
} else {
builder = new GeoPointFieldMapper.Builder(name);
}
parseField(builder, name, node, parserContext);
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
Map.Entry<String, Object> entry = iterator.next();
String propName = Strings.toUnderscoreCase(entry.getKey());
Object propNode = entry.getValue();
if (propName.equals("lat_lon")) {
deprecationLogger.deprecated(CONTENT_TYPE + " lat_lon parameter is deprecated and will be removed "
+ "in the next major release");
builder.enableLatLon(XContentMapValues.nodeBooleanValue(propNode));
iterator.remove();
} else if (propName.equals("precision_step")) {
deprecationLogger.deprecated(CONTENT_TYPE + " precision_step parameter is deprecated and will be removed "
+ "in the next major release");
builder.precisionStep(XContentMapValues.nodeIntegerValue(propNode));
iterator.remove();
} else if (propName.equals("geohash")) {
builder.enableGeoHash(XContentMapValues.nodeBooleanValue(propNode));
iterator.remove();
} else if (propName.equals("geohash_prefix")) {
builder.geoHashPrefix(XContentMapValues.nodeBooleanValue(propNode));
if (XContentMapValues.nodeBooleanValue(propNode)) {
builder.enableGeoHash(true);
}
iterator.remove();
} else if (propName.equals("geohash_precision")) {
if (propNode instanceof Integer) {
builder.geoHashPrecision(XContentMapValues.nodeIntegerValue(propNode));
} else {
builder.geoHashPrecision(GeoUtils.geoHashLevelsForPrecision(propNode.toString()));
}
iterator.remove();
} else if (propName.equals(Names.IGNORE_MALFORMED)) {
builder.ignoreMalformed(XContentMapValues.nodeBooleanValue(propNode));
iterator.remove();
} else if (parseMultiField(builder, name, parserContext, propName, propNode)) {
iterator.remove();
}
}
if (builder instanceof GeoPointFieldMapperLegacy.Builder) {
return GeoPointFieldMapperLegacy.parse((GeoPointFieldMapperLegacy.Builder) builder, node, parserContext);
}
return (GeoPointFieldMapper.Builder) builder;
}
示例6: parse
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
public static Builder parse(Builder builder, Map<String, Object> node, Mapper.TypeParser.ParserContext parserContext) throws MapperParsingException {
final boolean indexCreatedBeforeV2_0 = parserContext.indexVersionCreated().before(Version.V_2_0_0);
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
Map.Entry<String, Object> entry = iterator.next();
String propName = Strings.toUnderscoreCase(entry.getKey());
Object propNode = entry.getValue();
if (indexCreatedBeforeV2_0 && propName.equals("validate")) {
deprecationLogger.deprecated(CONTENT_TYPE + " validate parameter is deprecated and will be removed "
+ "in the next major release");
builder.ignoreMalformed = !XContentMapValues.nodeBooleanValue(propNode);
iterator.remove();
} else if (indexCreatedBeforeV2_0 && propName.equals("validate_lon")) {
deprecationLogger.deprecated(CONTENT_TYPE + " validate_lon parameter is deprecated and will be removed "
+ "in the next major release");
builder.ignoreMalformed = !XContentMapValues.nodeBooleanValue(propNode);
iterator.remove();
} else if (indexCreatedBeforeV2_0 && propName.equals("validate_lat")) {
deprecationLogger.deprecated(CONTENT_TYPE + " validate_lat parameter is deprecated and will be removed "
+ "in the next major release");
builder.ignoreMalformed = !XContentMapValues.nodeBooleanValue(propNode);
iterator.remove();
} else if (propName.equals(Names.COERCE)) {
builder.coerce = XContentMapValues.nodeBooleanValue(propNode);
iterator.remove();
} else if (indexCreatedBeforeV2_0 && propName.equals("normalize")) {
deprecationLogger.deprecated(CONTENT_TYPE + " normalize parameter is deprecated and will be removed "
+ "in the next major release");
builder.coerce = XContentMapValues.nodeBooleanValue(propNode);
iterator.remove();
} else if (indexCreatedBeforeV2_0 && propName.equals("normalize_lat")) {
deprecationLogger.deprecated(CONTENT_TYPE + " normalize_lat parameter is deprecated and will be removed "
+ "in the next major release");
builder.coerce = XContentMapValues.nodeBooleanValue(propNode);
iterator.remove();
} else if (indexCreatedBeforeV2_0 && propName.equals("normalize_lon")) {
deprecationLogger.deprecated(CONTENT_TYPE + " normalize_lon parameter is deprecated and will be removed "
+ "in the next major release");
builder.coerce = XContentMapValues.nodeBooleanValue(propNode);
iterator.remove();
}
}
return builder;
}
示例7: 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;
}
示例8: DriveRiver
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@Inject
@SuppressWarnings({ "unchecked" })
protected DriveRiver(RiverName riverName, RiverSettings settings, Client client) throws Exception{
super(riverName, settings);
this.client = client;
// Deal with connector settings.
if (settings.settings().containsKey("google-drive")){
Map<String, Object> feed = (Map<String, Object>)settings.settings().get("google-drive");
// Retrieve feed settings.
String feedname = XContentMapValues.nodeStringValue(feed.get("name"), null);
String folder = XContentMapValues.nodeStringValue(feed.get("folder"), null);
int updateRate = XContentMapValues.nodeIntegerValue(feed.get("update_rate"), 15 * 60 * 1000);
boolean jsonSupport = XContentMapValues.nodeBooleanValue(feed.get("json_support"), false);
String[] includes = DriveRiverUtil.buildArrayFromSettings(settings.settings(), "google-drive.includes");
String[] excludes = DriveRiverUtil.buildArrayFromSettings(settings.settings(), "google-drive.excludes");
// Retrieve connection settings.
String clientId = XContentMapValues.nodeStringValue(feed.get("clientId"), null);
String clientSecret = XContentMapValues.nodeStringValue(feed.get("clientSecret"), null);
String refreshToken = XContentMapValues.nodeStringValue(feed.get("refreshToken"), null);
feedDefinition = new DriveRiverFeedDefinition(feedname, folder, updateRate,
Arrays.asList(includes), Arrays.asList(excludes), clientId, clientSecret, refreshToken, jsonSupport);
} else {
logger.error("You didn't define the google-drive settings. Exiting... See https://github.com/lbroudoux/es-google-drive-river");
indexName = null;
typeName = null;
bulkSize = 100;
feedDefinition = null;
drive = 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"), DriveRiverUtil.INDEX_TYPE_DOC);
bulkSize = XContentMapValues.nodeIntegerValue(indexSettings.get("bulk_size"), 100);
} else {
indexName = riverName.name();
typeName = DriveRiverUtil.INDEX_TYPE_DOC;
bulkSize = 100;
}
// We need to connect to Google Drive.
drive = new DriveConnector(feedDefinition.getClientId(), feedDefinition.getClientSecret(), feedDefinition.getRefreshToken());
drive.connectUserDrive(feedDefinition.getFolder());
}
示例9: JolokiaRiver
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Inject
public JolokiaRiver(RiverName riverName, RiverSettings riverSettings,
@RiverIndexName String riverIndexName,
Client client) {
super(riverName, riverSettings);
// riverIndexName = _river
Map<String, Object> sourceSettings =
riverSettings.settings().containsKey(TYPE)
? (Map<String, Object>) riverSettings.settings().get(TYPE)
: new HashMap<String, Object>();
strategy = XContentMapValues.nodeStringValue(sourceSettings.get("strategy"), "simple");
riverSetting = new JolokiaRiverSetting();
riverSetting.setHosts(nodeToStringList(sourceSettings.get("hosts"), new ArrayList<String>()));
riverSetting.setUrl(XContentMapValues.nodeStringValue(sourceSettings.get("url"), null));
riverSetting.setObjectName(XContentMapValues.nodeStringValue(sourceSettings.get("objectName"), null));
riverSetting.setAttributes(nodeToAttributeList(sourceSettings.get("attributes"), new ArrayList<Attribute>()));
riverSetting.setPrefix(XContentMapValues.nodeStringValue(sourceSettings.get("prefix"), ""));
riverSetting.setConstants(nodeToMap(sourceSettings.get("constants"), new HashMap<String, Map<String, Object>>()));
riverSetting.setLogType(XContentMapValues.nodeStringValue(sourceSettings.get("logType"), null));
riverSetting.setOnlyUpdates(XContentMapValues.nodeBooleanValue(sourceSettings.get("onlyUpdates"),false));
poll = XContentMapValues.nodeTimeValue(sourceSettings.get("poll"), TimeValue.timeValueMinutes(1));
maxretries = XContentMapValues.nodeIntegerValue(sourceSettings.get("max_retries"), 3);
maxretrywait = TimeValue.parseTimeValue(XContentMapValues.nodeStringValue(sourceSettings.get("max_retries_wait"), "10s"), TimeValue.timeValueMillis(30000));
digesting = XContentMapValues.nodeBooleanValue(sourceSettings.get("digesting"), Boolean.TRUE);
Map<String, Object> targetSettings =
riverSettings.settings().containsKey("index")
? (Map<String, Object>) riverSettings.settings().get("index")
: new HashMap<String, Object>();
indexName = XContentMapValues.nodeStringValue(targetSettings.get("index"), TYPE);
typeName = XContentMapValues.nodeStringValue(targetSettings.get("type"), TYPE);
bulkSize = XContentMapValues.nodeIntegerValue(targetSettings.get("bulk_size"), 100);
maxBulkRequests = XContentMapValues.nodeIntegerValue(targetSettings.get("max_bulk_requests"), 30);
indexSettings = XContentMapValues.nodeStringValue(targetSettings.get("index_settings"), null);
typeMapping = XContentMapValues.nodeStringValue(targetSettings.get("type_mapping"), null);
versioning = XContentMapValues.nodeBooleanValue(sourceSettings.get("versioning"), Boolean.FALSE);
acknowledgeBulk = XContentMapValues.nodeBooleanValue(sourceSettings.get("acknowledge"), Boolean.FALSE);
riverSource = RiverServiceLoader.findRiverSource(strategy);
logger.debug("found river source {} for strategy {}", riverSource.getClass().getName(), strategy);
riverSource.setting(riverSetting);
riverMouth = RiverServiceLoader.findRiverMouth(strategy);
logger.debug("found river mouth {} for strategy {}", riverMouth.getClass().getName(), strategy);
riverMouth.indexTemplate(indexName)
.type(typeName)
.maxBulkActions(bulkSize)
.maxConcurrentBulkRequests(maxBulkRequests)
.acknowledge(acknowledgeBulk)
.versioning(versioning)
.client(client);
riverContext = new RiverContext()
.riverName(riverName.getName())
.riverIndexName(riverIndexName)
.riverSettings(riverSettings.settings())
.riverSource(riverSource)
.riverMouth(riverMouth)
.pollInterval(poll)
.retries(maxretries)
.maxRetryWait(maxretrywait)
.digesting(digesting)
.contextualize();
riverFlow = RiverServiceLoader.findRiverFlow(strategy);
// prepare task for run
riverFlow.riverContext(riverContext);
logger.debug("found river flow {} for strategy {}", riverFlow.getClass().getName(), strategy);
}