コード例 #1
0
        public static bool TryFrom(string version, out ElasticsearchVersion v)
        {
            v = null;
            try
            {
                v = ElasticsearchVersionResolver.From(version);
            }
            catch
            {
                // ignored
            }

            return(v != null);
        }
コード例 #2
0
        public string[] ToCommandLineArguments(ElasticsearchVersion version)
        {
            var settingsPrefix  = version > LastVersionWithoutPrefixForSettings ? "" : "es.";
            var settingArgument = version.Major >= 5 ? "-E " : "-D";

            return(this
                   //if a node setting is only applicable for a certain version make sure its filtered out
                   .Where(s => string.IsNullOrEmpty(s.VersionRange) || version.InRange(s.VersionRange))
                   //allow additional settings to take precedence over already DefaultNodeSettings
                   //without relying on elasticsearch to dedup, 5.4.0 no longer allows passing the same setting twice
                   //on the command with the latter taking precedence
                   .GroupBy(setting => setting.Key)
                   .Select(g => g.Last())
                   .Select(s => s.Key.StartsWith(settingArgument) ? s.ToString() : $"{settingArgument}{settingsPrefix}{s}")
                   .ToArray());
        }
コード例 #3
0
        public ElasticsearchDownloadLocations(ElasticsearchVersion version)
        {
            this.Version = version;

            switch (this.Version.ReleaseState)
            {
            case ReleaseState.Released:
                var downloadPath = Range.IsSatisfied("<5.0.0", version.Version)
                                                ? $"https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/zip/elasticsearch/{this.Version}"
                                                : $"{ArtifactsHost}/downloads/elasticsearch";
                this.ElasticsearchDownloadUrl = $"{downloadPath}/{this.Version.Zip}";
                break;

            case ReleaseState.Snapshot:
                this.ElasticsearchDownloadUrl = $"{SonaTypeUrl}/{version}/{this.Version.Zip}";
                break;

            case ReleaseState.BuildCandidate when ElasticsearchVersionResolver.TryParseBuildCandidate(version.Version, out var v, out var gitHash):
                var stagingRoot = string.Format(StagingUrlFormat, v, gitHash);

                this.ElasticsearchDownloadUrl = $"{stagingRoot}/downloads/elasticsearch/{this.Version.Zip}";
                break;
            }
        }
コード例 #4
0
 public ClusterConfiguration(ElasticsearchVersion version, Func <ElasticsearchVersion, string, NodeFileSystem> fileSystem = null, int numberOfNodes = 1, string clusterName = null)
     : base(version, fileSystem ?? ((v, s) => new NodeFileSystem(v, s)), numberOfNodes, clusterName)
 {
 }
コード例 #5
0
 public ClusterConfiguration(ElasticsearchVersion version, string esHome, int numberOfNodes = 1)
     : base(version, (v, s) => new NodeFileSystem(v, esHome), numberOfNodes, null)
 {
 }
コード例 #6
0
 public NodeConfiguration(ElasticsearchVersion version, int?port = null) : this(new ClusterConfiguration(version), port)
 {
 }
コード例 #7
0
 // ReSharper disable once UnusedMember.Local
 private bool Equals(ElasticsearchVersion other) => base.Equals(other);