Package org.elasticsearch

Examples of org.elasticsearch.Version


                            final JsonNode nodesList = resultTree.get("nodes");

                            final Iterator<String> nodes = nodesList.fieldNames();
                            while (nodes.hasNext()) {
                                final String id = nodes.next();
                                final Version clusterVersion = Version.fromString(nodesList.get(id).get("version").textValue());

                                if (!configuration.isEsDisableVersionCheck()) {
                                    checkClusterVersion(clusterVersion);
                                }
                            }
View Full Code Here


        stream = new HandlesStreamOutput(stream);

        // we pick the smallest of the 2, to support both backward and forward compatibility
        // note, this is the only place we need to do this, since from here on, we use the serialized version
        // as the version to use also when the node receiving this request will send the response with
        Version version = Version.smallest(this.version, node.version());

        stream.setVersion(version);
        stream.writeString(action);

        ChannelBuffer buffer;
View Full Code Here

        // buffer, or in the cumlation buffer, which is cleaned each time
        StreamInput streamIn = ChannelBufferStreamInputFactory.create(buffer, size);

        long requestId = buffer.readLong();
        byte status = buffer.readByte();
        Version version = Version.fromId(buffer.readInt());

        // !!! compression handling removed !!!
        StreamInput wrappedStream = CachedStreamInput.cachedHandles(streamIn);

        if (TransportStatus.isRequest(status)) {
View Full Code Here

                .build();
        Tuple<Settings, Environment> tuple = InternalSettingsPreparer.prepareSettings(
            settings, loadConfigSettings);

        this.settings = tuple.v1();
        Version version = Version.CURRENT;

        CompressorFactory.configure(this.settings);

        ModulesBuilder modules = new ModulesBuilder();
        modules.add(new CrateClientModule());
View Full Code Here

        } else {
            this.precisionStep = precisionStep;
        }
        this.ignoreMalformed = ignoreMalformed;
        this.coerce = coerce;
        Version v = Version.indexCreated(indexSettings);
        this.useSortedNumericDocValues = v.onOrAfter(Version.V_1_4_0_Beta1);
    }
View Full Code Here

        this.environment = tuple.v2();

        this.pluginsService = new PluginsService(settings, tuple.v2());
        this.settings = pluginsService.updatedSettings();

        Version version = Version.CURRENT;

        CompressorFactory.configure(this.settings);

        ModulesBuilder modules = new ModulesBuilder();
        modules.add(new Version.Module(version));
View Full Code Here

                .put(Client.CLIENT_TYPE_SETTING, CLIENT_TYPE).build();
        Tuple<Settings, Environment> tuple = InternalSettingsPreparer.prepareSettings(pSettings, loadConfigSettings);
        tuple = new Tuple<>(TribeService.processSettings(tuple.v1()), tuple.v2());

        // The only place we can actually fake the version a node is running on:
        Version version = pSettings.getAsVersion("tests.mock.version", Version.CURRENT);

        ESLogger logger = Loggers.getLogger(Node.class, tuple.v1().get("name"));
        logger.info("version[{}], pid[{}], build[{}/{}]", version, JvmInfo.jvmInfo().pid(), Build.CURRENT.hashShort(), Build.CURRENT.timestamp());

        logger.info("initializing ...");
View Full Code Here

        return indexShard;
    }

    private int shardId(ClusterState clusterState, String index, String type, String id, @Nullable String routing) {
        final IndexMetaData indexMetaData = indexMetaData(clusterState, index);
        final Version createdVersion = indexMetaData.getCreationVersion();
        final HashFunction hashFunction = indexMetaData.getRoutingHashFunction();
        final boolean useType = indexMetaData.getRoutingUseType();

        final int hash;
        if (routing == null) {
            if (!useType) {
                hash = hash(hashFunction, id);
            } else {
                hash = hash(hashFunction, type, id);
            }
        } else {
            hash = hash(hashFunction, routing);
        }
        if (createdVersion.onOrAfter(Version.V_2_0_0)) {
            return MathUtils.mod(hash, indexMetaData.numberOfShards());
        } else {
            return Math.abs(hash % indexMetaData.numberOfShards());
        }
    }
View Full Code Here

        }

        public DiscoveryNodes build() {
            ImmutableOpenMap.Builder<String, DiscoveryNode> dataNodesBuilder = ImmutableOpenMap.builder();
            ImmutableOpenMap.Builder<String, DiscoveryNode> masterNodesBuilder = ImmutableOpenMap.builder();
            Version minNodeVersion = Version.CURRENT;
            Version minNonClientNodeVersion = Version.CURRENT;
            for (ObjectObjectCursor<String, DiscoveryNode> nodeEntry : nodes) {
                if (nodeEntry.value.dataNode()) {
                    dataNodesBuilder.put(nodeEntry.key, nodeEntry.value);
                    minNonClientNodeVersion = Version.smallest(minNonClientNodeVersion, nodeEntry.value.version());
                }
View Full Code Here

        // special case, these two are the same instance
        assertThat(currentDefaultAnalyzer, is(currentStandardAnalyzer));
        PreBuiltAnalyzers.DEFAULT.getAnalyzer(Version.V_1_0_0_Beta1);
        final int n = scaledRandomIntBetween(10, 100);
        Version version = Version.CURRENT;
        for(int i = 0; i < n; i++) {
            if (version.equals(Version.V_1_0_0_Beta1)) {
                assertThat(currentDefaultAnalyzer, is(PreBuiltAnalyzers.DEFAULT.getAnalyzer(version)));
            } else {
                assertThat(currentDefaultAnalyzer, not(is(PreBuiltAnalyzers.DEFAULT.getAnalyzer(version))));
            }
            Analyzer analyzer = PreBuiltAnalyzers.DEFAULT.getAnalyzer(version);
            TokenStream ts = analyzer.tokenStream("foo", "This is it Dude");
            ts.reset();
            CharTermAttribute charTermAttribute = ts.addAttribute(CharTermAttribute.class);
            List<String> list = new ArrayList<>();
            while(ts.incrementToken()) {
                list.add(charTermAttribute.toString());
            }
            if (version.onOrAfter(Version.V_1_0_0_Beta1)) {
                assertThat(list.size(), is(4));
                assertThat(list, contains("this", "is", "it", "dude"));

            } else {
                assertThat(list.size(), is(1));
View Full Code Here

TOP

Related Classes of org.elasticsearch.Version

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.