本文整理了Java中org.elasticsearch.common.settings.Settings.getAsLong()
方法的一些代码示例,展示了Settings.getAsLong()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.getAsLong()
方法的具体详情如下:
包路径:org.elasticsearch.common.settings.Settings
类名称:Settings
方法名:getAsLong
[英]Returns the setting value (as long) associated with the setting key. If it does not exists, returns the default value provided.
[中]返回与设置键关联的设置值(尽可能长)。如果不存在,则返回提供的默认值。
代码示例来源:origin: org.elasticsearch/elasticsearch
public long getCreationDate() {
return settings.getAsLong(SETTING_CREATION_DATE, -1L);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private long timeCreated(Settings settings) {
return settings.getAsLong(IndexMetaData.SETTING_CREATION_DATE, -1L);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Adds human readable version and creation date settings.
* This method is used to display the settings in a human readable format in REST API
*/
public static Settings addHumanReadableSettings(Settings settings) {
Settings.Builder builder = Settings.builder().put(settings);
Version version = SETTING_INDEX_VERSION_CREATED.get(settings);
if (version != Version.V_EMPTY) {
builder.put(SETTING_VERSION_CREATED_STRING, version.toString());
}
Version versionUpgraded = settings.getAsVersion(SETTING_VERSION_UPGRADED, null);
if (versionUpgraded != null) {
builder.put(SETTING_VERSION_UPGRADED_STRING, versionUpgraded.toString());
}
Long creationDate = settings.getAsLong(SETTING_CREATION_DATE, null);
if (creationDate != null) {
ZonedDateTime creationDateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(creationDate), ZoneOffset.UTC);
builder.put(SETTING_CREATION_DATE_STRING, creationDateTime.toString());
}
return builder.build();
}
代码示例来源:origin: harbby/presto-connectors
public long getCreationDate() {
return settings.getAsLong(SETTING_CREATION_DATE, -1l);
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
private long timeCreated(Settings settings) {
return settings.getAsLong(IndexMetaData.SETTING_CREATION_DATE, -1L);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
public long getCreationDate() {
return settings.getAsLong(SETTING_CREATION_DATE, -1L);
}
代码示例来源:origin: harbby/presto-connectors
private long timeCreated(Settings settings) {
return settings.getAsLong(IndexMetaData.SETTING_CREATION_DATE, -1l);
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
public long getCreationDate() {
return settings.getAsLong(SETTING_CREATION_DATE, -1L);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
private long timeCreated(Settings settings) {
return settings.getAsLong(IndexMetaData.SETTING_CREATION_DATE, -1L);
}
代码示例来源:origin: apache/servicemix-bundles
private long timeCreated(Settings settings) {
return settings.getAsLong(IndexMetaData.SETTING_CREATION_DATE, -1L);
}
代码示例来源:origin: harbby/presto-connectors
public long creationDate() {
return settings.getAsLong(SETTING_CREATION_DATE, -1l);
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
/**
* Adds human readable version and creation date settings.
* This method is used to display the settings in a human readable format in REST API
*/
public static Settings addHumanReadableSettings(Settings settings) {
Settings.Builder builder = Settings.builder().put(settings);
Version version = settings.getAsVersion(SETTING_VERSION_CREATED, null);
if (version != null) {
builder.put(SETTING_VERSION_CREATED_STRING, version.toString());
}
Version versionUpgraded = settings.getAsVersion(SETTING_VERSION_UPGRADED, null);
if (versionUpgraded != null) {
builder.put(SETTING_VERSION_UPGRADED_STRING, versionUpgraded.toString());
}
Long creationDate = settings.getAsLong(SETTING_CREATION_DATE, null);
if (creationDate != null) {
DateTime creationDateTime = new DateTime(creationDate, DateTimeZone.UTC);
builder.put(SETTING_CREATION_DATE_STRING, creationDateTime.toString());
}
return builder.build();
}
代码示例来源:origin: harbby/presto-connectors
private void checkNestedFieldsLimit(Map<String, ObjectMapper> fullPathObjectMappers) {
long allowedNestedFields = indexSettingsService.getSettings().getAsLong(INDEX_MAPPING_NESTED_FIELDS_LIMIT_SETTING, 50L);
long actualNestedFields = 0;
for (ObjectMapper objectMapper : fullPathObjectMappers.values()) {
if (objectMapper.nested().isNested()) {
actualNestedFields++;
}
}
if (allowedNestedFields >= 0 && actualNestedFields > allowedNestedFields) {
throw new IllegalArgumentException("Limit of nested fields [" + allowedNestedFields + "] in index [" + index().name() + "] has been exceeded");
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
/**
* Adds human readable version and creation date settings.
* This method is used to display the settings in a human readable format in REST API
*/
public static Settings addHumanReadableSettings(Settings settings) {
Settings.Builder builder = Settings.builder().put(settings);
Version version = SETTING_INDEX_VERSION_CREATED.get(settings);
if (version != Version.V_EMPTY) {
builder.put(SETTING_VERSION_CREATED_STRING, version.toString());
}
Version versionUpgraded = settings.getAsVersion(SETTING_VERSION_UPGRADED, null);
if (versionUpgraded != null) {
builder.put(SETTING_VERSION_UPGRADED_STRING, versionUpgraded.toString());
}
Long creationDate = settings.getAsLong(SETTING_CREATION_DATE, null);
if (creationDate != null) {
ZonedDateTime creationDateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(creationDate), ZoneOffset.UTC);
builder.put(SETTING_CREATION_DATE_STRING, creationDateTime.toString());
}
return builder.build();
}
代码示例来源:origin: harbby/presto-connectors
/**
* Adds human readable version and creation date settings.
* This method is used to display the settings in a human readable format in REST API
*/
public static Settings addHumanReadableSettings(Settings settings) {
Settings.Builder builder = Settings.builder().put(settings);
Version version = settings.getAsVersion(SETTING_VERSION_CREATED, null);
if (version != null) {
builder.put(SETTING_VERSION_CREATED_STRING, version.toString());
}
Version versionUpgraded = settings.getAsVersion(SETTING_VERSION_UPGRADED, null);
if (versionUpgraded != null) {
builder.put(SETTING_VERSION_UPGRADED_STRING, versionUpgraded.toString());
}
Long creationDate = settings.getAsLong(SETTING_CREATION_DATE, null);
if (creationDate != null) {
DateTime creationDateTime = new DateTime(creationDate, DateTimeZone.UTC);
builder.put(SETTING_CREATION_DATE_STRING, creationDateTime.toString());
}
return builder.build();
}
代码示例来源:origin: floragunncom/search-guard-ssl
validator.setCheckOnlyEndEntities(settings.getAsBoolean(SSLConfigConstants.SEARCHGUARD_SSL_HTTP_CRL_CHECK_ONLY_END_ENTITIES, true));
validator.setPreferCrl(settings.getAsBoolean(SSLConfigConstants.SEARCHGUARD_SSL_HTTP_CRL_PREFER_CRLFILE_OVER_OCSP, false));
Long dateTimestamp = settings.getAsLong(SSLConfigConstants.SEARCHGUARD_SSL_HTTP_CRL_VALIDATION_DATE, null);
if(dateTimestamp != null && dateTimestamp.longValue() < 0) {
dateTimestamp = null;
代码示例来源:origin: FINRAOS/herd
/**
* Creates a new search index statistics objects per specified parameters.
*
* @param settings the search index settings
* @param docsStats the search index docs stats
* @param indexCount the count of index
*
* @return the newly created search index statistics object
*/
protected SearchIndexStatistics createSearchIndexStatistics(Settings settings, DocsStats docsStats, long indexCount)
{
SearchIndexStatistics searchIndexStatistics = new SearchIndexStatistics();
Long creationDate = settings.getAsLong(IndexMetaData.SETTING_CREATION_DATE, -1L);
if (creationDate.longValue() != -1L)
{
DateTime creationDateTime = new DateTime(creationDate, DateTimeZone.UTC);
searchIndexStatistics.setIndexCreationDate(HerdDateUtils.getXMLGregorianCalendarValue(creationDateTime.toDate()));
}
searchIndexStatistics.setIndexNumberOfActiveDocuments(docsStats.getCount());
searchIndexStatistics.setIndexNumberOfDeletedDocuments(docsStats.getDeleted());
searchIndexStatistics.setIndexUuid(settings.get(IndexMetaData.SETTING_INDEX_UUID));
searchIndexStatistics.setIndexCount(indexCount);
return searchIndexStatistics;
}
代码示例来源:origin: org.finra.herd/herd-service
/**
* Creates a new search index statistics objects per specified parameters.
*
* @param settings the search index settings
* @param docsStats the search index docs stats
* @param indexCount the count of index
*
* @return the newly created search index statistics object
*/
protected SearchIndexStatistics createSearchIndexStatistics(Settings settings, DocsStats docsStats, long indexCount)
{
SearchIndexStatistics searchIndexStatistics = new SearchIndexStatistics();
Long creationDate = settings.getAsLong(IndexMetaData.SETTING_CREATION_DATE, -1L);
if (creationDate.longValue() != -1L)
{
DateTime creationDateTime = new DateTime(creationDate, DateTimeZone.UTC);
searchIndexStatistics.setIndexCreationDate(HerdDateUtils.getXMLGregorianCalendarValue(creationDateTime.toDate()));
}
searchIndexStatistics.setIndexNumberOfActiveDocuments(docsStats.getCount());
searchIndexStatistics.setIndexNumberOfDeletedDocuments(docsStats.getDeleted());
searchIndexStatistics.setIndexUuid(settings.get(IndexMetaData.SETTING_INDEX_UUID));
searchIndexStatistics.setIndexCount(indexCount);
return searchIndexStatistics;
}
内容来源于网络,如有侵权,请联系作者删除!