本文整理了Java中org.elasticsearch.Version.before()
方法的一些代码示例,展示了Version.before()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.before()
方法的具体详情如下:
包路径:org.elasticsearch.Version
类名称:Version
方法名:before
暂无
代码示例来源:origin: floragunncom/search-guard
private static boolean clusterHas5xNodes(ClusterState state) {
return state.nodes().getMinNodeVersion().before(Version.V_6_0_0_alpha1);
}
代码示例来源:origin: floragunncom/search-guard
private static boolean clusterHas5xIndices(ClusterState state) {
final Iterator<IndexMetaData> indices = state.metaData().indices().valuesIt();
for(;indices.hasNext();) {
final IndexMetaData indexMetaData = indices.next();
if(indexMetaData.getCreationVersion().before(Version.V_6_0_0_alpha1)) {
return true;
}
}
return false;
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private void checkVersion(Version version) {
if (version.before(Version.V_5_2_0)) {
throw new IllegalArgumentException("cannot explain shards in a mixed-cluster with pre-" + Version.V_5_2_0 +
" nodes, node version [" + version + "]");
}
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private static SimilarityProvider resolveSimilarity(Mapper.TypeParser.ParserContext parserContext, String name, String value) {
if (parserContext.indexVersionCreated().before(Version.V_5_0_0_alpha1) && "default".equals(value)) {
// "default" similarity has been renamed into "classic" in 3.x.
value = "classic";
}
SimilarityProvider similarityProvider = parserContext.getSimilarity(value);
if (similarityProvider == null) {
throw new MapperParsingException("Unknown Similarity type [" + value + "] for field [" + name + "]");
}
return similarityProvider;
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
public SliceBuilder(StreamInput in) throws IOException {
String field = in.readString();
if (UidFieldMapper.NAME.equals(field) && in.getVersion().before(Version.V_6_3_0)) {
// This is safe because _id and _uid are handled the same way in #toFilter
field = IdFieldMapper.NAME;
}
this.field = field;
this.id = in.readVInt();
this.max = in.readVInt();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* BWC serialization for nested {@link InnerHitBuilder}.
* Should only be used to send nested inner hits to nodes pre 5.5.
*/
protected void writeToNestedBWC(StreamOutput out, QueryBuilder query, String nestedPath) throws IOException {
assert out.getVersion().before(Version.V_5_5_0) :
"invalid output version, must be < " + Version.V_5_5_0.toString();
writeToBWC(out, query, nestedPath, null);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public void readFrom(StreamInput in) throws IOException {
sizeInBytes = in.readVLong();
if (in.getVersion().before(Version.V_6_0_0_alpha1)) {
in.readVLong(); // throttleTimeInNanos
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(sizeInBytes);
if (out.getVersion().before(Version.V_6_0_0_alpha1)) {
out.writeVLong(0L); // throttleTimeInNanos
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* BWC serialization for parent/child {@link InnerHitBuilder}.
* Should only be used to send hasParent or hasChild inner hits to nodes pre 5.5.
*/
public void writeToParentChildBWC(StreamOutput out, QueryBuilder query, String parentChildPath) throws IOException {
assert(out.getVersion().before(Version.V_5_5_0)) :
"invalid output version, must be < " + Version.V_5_5_0.toString();
writeToBWC(out, query, null, parentChildPath);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
static void validateSplitIndex(ClusterState state, String sourceIndex,
Set<String> targetIndexMappingsTypes, String targetIndexName,
Settings targetIndexSettings) {
IndexMetaData sourceMetaData = validateResize(state, sourceIndex, targetIndexMappingsTypes, targetIndexName, targetIndexSettings);
IndexMetaData.selectSplitShard(0, sourceMetaData, IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings));
if (sourceMetaData.getCreationVersion().before(Version.V_6_0_0_alpha1)) {
// ensure we have a single type since this would make the splitting code considerably more complex
// and a 5.x index would not be splittable unless it has been shrunk before so rather opt out of the complexity
// since in 5.x we don't have a setting to artificially set the number of routing shards
throw new IllegalStateException("source index created version is too old to apply a split operation");
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public Query termQuery(Object value, QueryShardContext context) {
failIfNotIndexed();
TermQuery query = new TermQuery(new Term(name(), indexedValueForSearch(value)));
if (boost() == 1f ||
(context != null && context.indexVersionCreated().before(Version.V_5_0_0_alpha1))) {
return query;
}
return new BoostQuery(query, boost());
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public void writeTo(StreamOutput out) throws IOException {
if (IdFieldMapper.NAME.equals(field) && out.getVersion().before(Version.V_6_3_0)) {
out.writeString(UidFieldMapper.NAME);
} else {
out.writeString(field);
}
out.writeVInt(id);
out.writeVInt(max);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private boolean isTargetSameHistory() {
final String targetHistoryUUID = request.metadataSnapshot().getHistoryUUID();
assert targetHistoryUUID != null || shard.indexSettings().getIndexVersionCreated().before(Version.V_6_0_0_rc1) :
"incoming target history N/A but index was created after or on 6.0.0-rc1";
return targetHistoryUUID != null && targetHistoryUUID.equals(shard.getHistoryUUID());
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* BWC serialization for collapsing {@link InnerHitBuilder}.
* Should only be used to send collapsing inner hits to nodes pre 5.5.
*/
public void writeToCollapseBWC(StreamOutput out) throws IOException {
assert out.getVersion().before(Version.V_5_5_0) :
"invalid output version, must be < " + Version.V_5_5_0.toString();
writeToBWC(out, new MatchAllQueryBuilder(), null, null);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
if (in.getVersion().before(Version.V_6_0_0_alpha2)) {
in.readString(); // read lang from previous versions
}
id = in.readString();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().before(Version.V_6_2_0)) {
out.writeVLong(getBytes());
} else {
out.writeZLong(size);
unit.writeTo(out);
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
public NodeAllocationResult(StreamInput in) throws IOException {
node = new DiscoveryNode(in);
shardStoreInfo = in.readOptionalWriteable(ShardStoreInfo::new);
if (in.getVersion().before(Version.V_5_2_1)) {
canAllocateDecision = Decision.readFrom(in);
} else {
canAllocateDecision = in.readOptionalWriteable(Decision::readFrom);
}
nodeDecision = AllocationDecision.readFrom(in);
weightRanking = in.readVInt();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeBoolean(queryCache);
out.writeBoolean(fieldDataCache);
if (out.getVersion().before(Version.V_6_0_0_beta1)) {
out.writeBoolean(false); // recycler
}
out.writeStringArrayNullable(fields);
out.writeBoolean(requestCache);
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalString(path); // total aggregates do not have a path
out.writeOptionalString(mount);
out.writeOptionalString(type);
out.writeLong(total);
out.writeLong(free);
out.writeLong(available);
if (out.getVersion().before(Version.V_6_0_0_alpha1)) {
out.writeOptionalBoolean(null);
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/*** Implementation of {@link RecoveryTargetHandler } */
@Override
public void prepareForTranslogOperations(boolean fileBasedRecovery, int totalTranslogOps) throws IOException {
if (fileBasedRecovery && indexShard.indexSettings().getIndexVersionCreated().before(Version.V_6_0_0)) {
store.ensureIndexHas6xCommitTags();
}
state().getTranslog().totalOperations(totalTranslogOps);
indexShard().openEngineAndSkipTranslogRecovery();
}
内容来源于网络,如有侵权,请联系作者删除!