当前位置: 首页>>代码示例>>Java>>正文


Java Version.indexCreated方法代码示例

本文整理汇总了Java中org.elasticsearch.Version.indexCreated方法的典型用法代码示例。如果您正苦于以下问题:Java Version.indexCreated方法的具体用法?Java Version.indexCreated怎么用?Java Version.indexCreated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.Version的用法示例。


在下文中一共展示了Version.indexCreated方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateIndexMetaData

import org.elasticsearch.Version; //导入方法依赖的package包/类
/**
 * Updates the settings and index metadata and notifies all registered settings consumers with the new settings iff at least one setting has changed.
 *
 * @return <code>true</code> iff any setting has been updated otherwise <code>false</code>.
 */
public synchronized boolean updateIndexMetaData(IndexMetaData indexMetaData) {
    final Settings newSettings = indexMetaData.getSettings();
    if (version.equals(Version.indexCreated(newSettings)) == false) {
        throw new IllegalArgumentException("version mismatch on settings update expected: " + version + " but was: " + Version.indexCreated(newSettings));
    }
    final String newUUID = newSettings.get(IndexMetaData.SETTING_INDEX_UUID, IndexMetaData.INDEX_UUID_NA_VALUE);
    if (newUUID.equals(getUUID()) == false) {
        throw new IllegalArgumentException("uuid mismatch on settings update expected: " + getUUID() + " but was: " + newUUID);
    }
    this.indexMetaData = indexMetaData;
    final Settings existingSettings = this.settings;
    if (existingSettings.filter(IndexScopedSettings.INDEX_SETTINGS_KEY_PREDICATE).getAsMap().equals(newSettings.filter(IndexScopedSettings.INDEX_SETTINGS_KEY_PREDICATE).getAsMap())) {
        // nothing to update, same settings
        return false;
    }
    scopedSettings.applySettings(newSettings);
    this.settings = Settings.builder().put(nodeSettings).put(newSettings).build();
    return true;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:IndexSettings.java

示例2: StandardAnalyzerProvider

import org.elasticsearch.Version; //导入方法依赖的package包/类
public StandardAnalyzerProvider(Index index, Settings indexSettings, Environment env, String name, Settings settings) {
    super(index, indexSettings, name, settings);
    this.esVersion = Version.indexCreated(indexSettings);
    final CharArraySet defaultStopwords;
    if (esVersion.onOrAfter(Version.V_1_0_0_Beta1)) {
        defaultStopwords = CharArraySet.EMPTY_SET;
    } else {
        defaultStopwords = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
    }

    CharArraySet stopWords = Analysis.parseStopWords(env, settings, defaultStopwords);
    int maxTokenLength = settings.getAsInt("max_token_length", StandardAnalyzer.DEFAULT_MAX_TOKEN_LENGTH);
    standardAnalyzer = new StandardAnalyzer(stopWords);
    standardAnalyzer.setVersion(version);
    standardAnalyzer.setMaxTokenLength(maxTokenLength);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:StandardAnalyzerProvider.java

示例3: PatternAnalyzerProvider

import org.elasticsearch.Version; //导入方法依赖的package包/类
@Inject
public PatternAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);

    Version esVersion = Version.indexCreated(indexSettingsService.getSettings());
    final CharArraySet defaultStopwords;
    if (esVersion.onOrAfter(Version.V_1_0_0_RC1)) {
        defaultStopwords = CharArraySet.EMPTY_SET;
    } else {
        defaultStopwords = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
    }
    boolean lowercase = settings.getAsBoolean("lowercase", true);
    CharArraySet stopWords = Analysis.parseStopWords(env, settings, defaultStopwords);

    String sPattern = settings.get("pattern", "\\W+" /*PatternAnalyzer.NON_WORD_PATTERN*/);
    if (sPattern == null) {
        throw new IllegalArgumentException("Analyzer [" + name + "] of type pattern must have a `pattern` set");
    }
    Pattern pattern = Regex.compile(sPattern, settings.get("flags"));

    analyzer = new PatternAnalyzer(pattern, lowercase, stopWords);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:23,代码来源:PatternAnalyzerProvider.java

示例4: get

import org.elasticsearch.Version; //导入方法依赖的package包/类
public TokenizerFactory get(IndexSettings indexSettings, Environment environment, String name, Settings settings) throws IOException {
    Version indexVersion = Version.indexCreated(settings);
    if (!Version.CURRENT.equals(indexVersion)) {
        PreBuiltTokenizers preBuiltTokenizers = PreBuiltTokenizers.getOrDefault(name, null);
        if (preBuiltTokenizers != null) {
            return preBuiltTokenizers.getTokenizerFactory(indexVersion);
        }
    }

    return tokenizerFactory;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:PreBuiltTokenizerFactoryFactory.java

示例5: create

import org.elasticsearch.Version; //导入方法依赖的package包/类
public AnalyzerProvider<?> create(String name, Settings settings) {
    Version indexVersion = Version.indexCreated(settings);
    if (!Version.CURRENT.equals(indexVersion)) {
        PreBuiltAnalyzers preBuiltAnalyzers = PreBuiltAnalyzers.getOrDefault(name, null);
        if (preBuiltAnalyzers != null) {
            Analyzer analyzer = preBuiltAnalyzers.getAnalyzer(indexVersion);
            return new PreBuiltAnalyzerProvider(name, AnalyzerScope.INDICES, analyzer);
        }
    }

    return analyzerProvider;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:PreBuiltAnalyzerProviderFactory.java

示例6: joinFieldTypeForParentType

import org.elasticsearch.Version; //导入方法依赖的package包/类
private static MappedFieldType joinFieldTypeForParentType(String parentType, Settings indexSettings) {
    MappedFieldType parentJoinFieldType = Defaults.JOIN_FIELD_TYPE.clone();
    parentJoinFieldType.setNames(new MappedFieldType.Names(joinField(parentType)));

    Version indexCreated = Version.indexCreated(indexSettings);
    if (indexCreated.before(Version.V_2_0_0_beta1)) {
        parentJoinFieldType.setHasDocValues(false);
        parentJoinFieldType.setDocValuesType(DocValuesType.NONE);
    }
    parentJoinFieldType.freeze();
    return parentJoinFieldType;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:ParentFieldMapper.java

示例7: get

import org.elasticsearch.Version; //导入方法依赖的package包/类
@Override
public TokenFilterFactory get(IndexSettings indexSettings, Environment environment, String name, Settings settings) throws IOException {
    Version indexVersion = Version.indexCreated(settings);
    if (!Version.CURRENT.equals(indexVersion)) {
        PreBuiltTokenFilters preBuiltTokenFilters = PreBuiltTokenFilters.getOrDefault(name, null);
        if (preBuiltTokenFilters != null) {
            return preBuiltTokenFilters.getTokenFilterFactory(indexVersion);
        }
    }
    return tokenFilterFactory;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:PreBuiltTokenFilterFactoryFactory.java

示例8: minimumCompatibleVersion

import org.elasticsearch.Version; //导入方法依赖的package包/类
public org.apache.lucene.util.Version minimumCompatibleVersion() {
    org.apache.lucene.util.Version luceneVersion = null;
    for (Segment segment : engine().segments(false)) {
        if (luceneVersion == null || luceneVersion.onOrAfter(segment.getVersion())) {
            luceneVersion = segment.getVersion();
        }
    }
    return luceneVersion == null ? Version.indexCreated(indexSettings).luceneVersion : luceneVersion;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:10,代码来源:IndexShard.java

示例9: StandardHtmlStripAnalyzerProvider

import org.elasticsearch.Version; //导入方法依赖的package包/类
@Inject
public StandardHtmlStripAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env,  @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    this.esVersion = Version.indexCreated(indexSettingsService.getSettings());
    final CharArraySet defaultStopwords;
    if (esVersion.onOrAfter(Version.V_1_0_0_RC1)) {
        defaultStopwords = CharArraySet.EMPTY_SET;
    } else {
        defaultStopwords = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
    }
    CharArraySet stopWords = Analysis.parseStopWords(env, settings, defaultStopwords);
    analyzer = new StandardHtmlStripAnalyzer(stopWords);
    analyzer.setVersion(version);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:StandardHtmlStripAnalyzerProvider.java

示例10: create

import org.elasticsearch.Version; //导入方法依赖的package包/类
@Override
public TokenizerFactory create(String name, Settings settings) {
    Version indexVersion = Version.indexCreated(settings);
    if (!Version.CURRENT.equals(indexVersion)) {
        PreBuiltTokenizers preBuiltTokenizers = PreBuiltTokenizers.getOrDefault(name, null);
        if (preBuiltTokenizers != null) {
            return preBuiltTokenizers.getTokenizerFactory(indexVersion);
        }
    }

    return tokenizerFactory;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:PreBuiltTokenizerFactoryFactory.java

示例11: create

import org.elasticsearch.Version; //导入方法依赖的package包/类
@Override
public AnalyzerProvider create(String name, Settings settings) {
    Version indexVersion = Version.indexCreated(settings);
    if (!Version.CURRENT.equals(indexVersion)) {
        PreBuiltAnalyzers preBuiltAnalyzers = PreBuiltAnalyzers.getOrDefault(name, null);
        if (preBuiltAnalyzers != null) {
            Analyzer analyzer = preBuiltAnalyzers.getAnalyzer(indexVersion);
            return new PreBuiltAnalyzerProvider(name, AnalyzerScope.INDICES, analyzer);
        }
    }

    return analyzerProvider;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:14,代码来源:PreBuiltAnalyzerProviderFactory.java

示例12: create

import org.elasticsearch.Version; //导入方法依赖的package包/类
@Override
public CharFilterFactory create(String name, Settings settings) {
    Version indexVersion = Version.indexCreated(settings);
    if (!Version.CURRENT.equals(indexVersion)) {
        PreBuiltCharFilters preBuiltCharFilters = PreBuiltCharFilters.getOrDefault(name, null);
        if (preBuiltCharFilters != null) {
            return preBuiltCharFilters.getCharFilterFactory(indexVersion);
        }
    }

    return charFilterFactory;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:PreBuiltCharFilterFactoryFactory.java

示例13: create

import org.elasticsearch.Version; //导入方法依赖的package包/类
@Override
public TokenFilterFactory create(String name, Settings settings) {
    Version indexVersion = Version.indexCreated(settings);
    if (!Version.CURRENT.equals(indexVersion)) {
        PreBuiltTokenFilters preBuiltTokenFilters = PreBuiltTokenFilters.getOrDefault(name, null);
        if (preBuiltTokenFilters != null) {
            return preBuiltTokenFilters.getTokenFilterFactory(indexVersion);
        }
    }
    return tokenFilterFactory;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:12,代码来源:PreBuiltTokenFilterFactoryFactory.java

示例14: getVersion

import org.elasticsearch.Version; //导入方法依赖的package包/类
private Version getVersion(MetaData metaData, String concreteIndex) {
    // this can go away in 3.0 but is here now for easy backporting - since in 2.x we need the version on the timestamp stuff
    final IndexMetaData indexMetaData = metaData.getIndices().get(concreteIndex);
    if (indexMetaData == null) {
        throw new IndexNotFoundException(concreteIndex);
    }
    return Version.indexCreated(indexMetaData.getSettings());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:IndexRequest.java

示例15: build

import org.elasticsearch.Version; //导入方法依赖的package包/类
public DocumentMapper build(MapperService mapperService) {
    Objects.requireNonNull(rootObjectMapper, "Mapper builder must have the root object mapper set");
    Mapping mapping = new Mapping(
            Version.indexCreated(mapperService.indexSettings()),
            rootObjectMapper,
            metadataMappers.values().toArray(new MetadataFieldMapper[metadataMappers.values().size()]),
            sourceTransforms.toArray(new SourceTransform[sourceTransforms.size()]),
            meta);
    return new DocumentMapper(mapperService, mapping);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:DocumentMapper.java


注:本文中的org.elasticsearch.Version.indexCreated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。