public static int generateShardId(IndexMetaData indexMetaData, @Nullable String id, @Nullable String routing) { final String effectiveRouting; final int partitionOffset; if (routing == null) { assert(indexMetaData.isRoutingPartitionedIndex() == false) : "A routing value is required for gets from a partitioned index"; effectiveRouting = id; } else { effectiveRouting = routing; } if (indexMetaData.isRoutingPartitionedIndex()) { partitionOffset = Math.floorMod(Murmur3HashFunction.hash(id), indexMetaData.getRoutingPartitionSize()); } else { // we would have still got 0 above but this check just saves us an unnecessary hash calculation partitionOffset = 0; } return calculateScaledShardId(indexMetaData, effectiveRouting, partitionOffset); }
private void checkPartitionedIndexConstraints(DocumentMapper newMapper) { if (indexSettings.getIndexMetaData().isRoutingPartitionedIndex()) { if (newMapper.parentFieldMapper().active()) { throw new IllegalArgumentException("mapping type name [" + newMapper.type() + "] cannot have a " + "_parent field for the partitioned index [" + indexSettings.getIndex().getName() + "]"); } if (!newMapper.routingFieldMapper().required()) { throw new IllegalArgumentException("mapping type [" + newMapper.type() + "] must have routing " + "required for partitioned index [" + indexSettings.getIndex().getName() + "]"); } } }
assert indexMetaData.isRoutingPartitionedIndex() == false; findSplitDocs(IdFieldMapper.NAME, includeInShard, leafReader, bitSet::set); } else { if (indexMetaData.isRoutingPartitionedIndex()) {
private static void checkIndexCompatibility(IndexSettings settings, String name) { if (settings.getIndexMetaData().isRoutingPartitionedIndex()) { throw new IllegalStateException("cannot create join field [" + name + "] " + "for the partitioned index " + "[" + settings.getIndex().getName() + "]"); } if (settings.isSingleType() == false) { throw new IllegalStateException("cannot create join field [" + name + "] " + "on multi-types index [" + settings.getIndex().getName() + "]"); } }
private static void checkIndexCompatibility(IndexSettings settings, String name) { if (settings.getIndexMetaData().isRoutingPartitionedIndex()) { throw new IllegalStateException("cannot create join field [" + name + "] " + "for the partitioned index " + "[" + settings.getIndex().getName() + "]"); } if (settings.isSingleType() == false) { throw new IllegalStateException("cannot create join field [" + name + "] " + "on multi-types index [" + settings.getIndex().getName() + "]"); } }
private static void checkIndexCompatibility(IndexSettings settings, String name) { if (settings.getIndexMetaData().isRoutingPartitionedIndex()) { throw new IllegalStateException("cannot create join field [" + name + "] " + "for the partitioned index " + "[" + settings.getIndex().getName() + "]"); } if (settings.isSingleType() == false) { throw new IllegalStateException("cannot create join field [" + name + "] " + "on multi-types index [" + settings.getIndex().getName() + "]"); } }
private void checkPartitionedIndexConstraints(DocumentMapper newMapper) { if (indexSettings.getIndexMetaData().isRoutingPartitionedIndex()) { if (newMapper.parentFieldMapper().active()) { throw new IllegalArgumentException("mapping type name [" + newMapper.type() + "] cannot have a " + "_parent field for the partitioned index [" + indexSettings.getIndex().getName() + "]"); } if (!newMapper.routingFieldMapper().required()) { throw new IllegalArgumentException("mapping type [" + newMapper.type() + "] must have routing " + "required for partitioned index [" + indexSettings.getIndex().getName() + "]"); } } }
static int generateShardId(IndexMetaData indexMetaData, @Nullable String id, @Nullable String routing) { final String effectiveRouting; final int partitionOffset; if (routing == null) { assert(indexMetaData.isRoutingPartitionedIndex() == false) : "A routing value is required for gets from a partitioned index"; effectiveRouting = id; } else { effectiveRouting = routing; } if (indexMetaData.isRoutingPartitionedIndex()) { partitionOffset = Math.floorMod(Murmur3HashFunction.hash(id), indexMetaData.getRoutingPartitionSize()); } else { // we would have still got 0 above but this check just saves us an unnecessary hash calculation partitionOffset = 0; } return calculateScaledShardId(indexMetaData, effectiveRouting, partitionOffset); }
public static int generateShardId(IndexMetaData indexMetaData, @Nullable String id, @Nullable String routing) { final String effectiveRouting; final int partitionOffset; if (routing == null) { assert(indexMetaData.isRoutingPartitionedIndex() == false) : "A routing value is required for gets from a partitioned index"; effectiveRouting = id; } else { effectiveRouting = routing; } if (indexMetaData.isRoutingPartitionedIndex()) { partitionOffset = Math.floorMod(Murmur3HashFunction.hash(id), indexMetaData.getRoutingPartitionSize()); } else { // we would have still got 0 above but this check just saves us an unnecessary hash calculation partitionOffset = 0; } return calculateScaledShardId(indexMetaData, effectiveRouting, partitionOffset); }
public static int generateShardId(IndexMetaData indexMetaData, @Nullable String id, @Nullable String routing) { final String effectiveRouting; final int partitionOffset; if (routing == null) { assert(indexMetaData.isRoutingPartitionedIndex() == false) : "A routing value is required for gets from a partitioned index"; effectiveRouting = id; } else { effectiveRouting = routing; } if (indexMetaData.isRoutingPartitionedIndex()) { partitionOffset = Math.floorMod(Murmur3HashFunction.hash(id), indexMetaData.getRoutingPartitionSize()); } else { // we would have still got 0 above but this check just saves us an unnecessary hash calculation partitionOffset = 0; } return calculateScaledShardId(indexMetaData, effectiveRouting, partitionOffset); }
private void checkPartitionedIndexConstraints(DocumentMapper newMapper) { if (indexSettings.getIndexMetaData().isRoutingPartitionedIndex()) { if (newMapper.parentFieldMapper().active()) { throw new IllegalArgumentException("mapping type name [" + newMapper.type() + "] cannot have a " + "_parent field for the partitioned index [" + indexSettings.getIndex().getName() + "]"); } if (!newMapper.routingFieldMapper().required()) { throw new IllegalArgumentException("mapping type [" + newMapper.type() + "] must have routing " + "required for partitioned index [" + indexSettings.getIndex().getName() + "]"); } } }
private void checkPartitionedIndexConstraints(DocumentMapper newMapper) { if (indexSettings.getIndexMetaData().isRoutingPartitionedIndex()) { if (newMapper.parentFieldMapper().active()) { throw new IllegalArgumentException("mapping type name [" + newMapper.type() + "] cannot have a " + "_parent field for the partitioned index [" + indexSettings.getIndex().getName() + "]"); } if (!newMapper.routingFieldMapper().required()) { throw new IllegalArgumentException("mapping type [" + newMapper.type() + "] must have routing " + "required for partitioned index [" + indexSettings.getIndex().getName() + "]"); } } }
assert indexMetaData.isRoutingPartitionedIndex() == false; findSplitDocs(IdFieldMapper.NAME, includeInShard, leafReader, bitSet::set); } else { if (indexMetaData.isRoutingPartitionedIndex()) {
assert indexMetaData.isRoutingPartitionedIndex() == false; findSplitDocs(IdFieldMapper.NAME, includeInShard, leafReader, bitSet::set); } else { if (indexMetaData.isRoutingPartitionedIndex()) {