elastic-stats 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +41 -0
 - data/.ruby-version +1 -0
 - data/Gemfile +4 -0
 - data/Guardfile +11 -0
 - data/LICENSE +22 -0
 - data/LICENSE.txt +22 -0
 - data/README.md +29 -0
 - data/Rakefile +9 -0
 - data/elastic-stats.gemspec +31 -0
 - data/lib/elastic/stats.rb +7 -0
 - data/lib/elastic/stats/elastic_client.rb +30 -0
 - data/lib/elastic/stats/ks.rb +101 -0
 - data/lib/elastic/stats/version.rb +6 -0
 - data/spec/elastic/stats/elastic_client_spec.rb +51 -0
 - data/spec/elastic/stats/ks_spec.rb +71 -0
 - data/spec/fixtures/basic_search_request.json +1 -0
 - data/spec/fixtures/successful_search.json +1 -0
 - data/spec/helpers/utility.rb +3 -0
 - data/spec/spec_helper.rb +12 -0
 - metadata +247 -0
 
    
        data/.gitignore
    ADDED
    
    | 
         @@ -0,0 +1,41 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            *.gem
         
     | 
| 
      
 2 
     | 
    
         
            +
            *.rbc
         
     | 
| 
      
 3 
     | 
    
         
            +
            /.config
         
     | 
| 
      
 4 
     | 
    
         
            +
            /coverage/
         
     | 
| 
      
 5 
     | 
    
         
            +
            /InstalledFiles
         
     | 
| 
      
 6 
     | 
    
         
            +
            /pkg/
         
     | 
| 
      
 7 
     | 
    
         
            +
            /spec/reports/
         
     | 
| 
      
 8 
     | 
    
         
            +
            /test/tmp/
         
     | 
| 
      
 9 
     | 
    
         
            +
            /test/version_tmp/
         
     | 
| 
      
 10 
     | 
    
         
            +
            /tmp/
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            ## Specific to RubyMotion:
         
     | 
| 
      
 13 
     | 
    
         
            +
            .dat*
         
     | 
| 
      
 14 
     | 
    
         
            +
            .repl_history
         
     | 
| 
      
 15 
     | 
    
         
            +
            build/
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            ## Documentation cache and generated files:
         
     | 
| 
      
 18 
     | 
    
         
            +
            /.yardoc/
         
     | 
| 
      
 19 
     | 
    
         
            +
            /_yardoc/
         
     | 
| 
      
 20 
     | 
    
         
            +
            /doc/
         
     | 
| 
      
 21 
     | 
    
         
            +
            /rdoc/
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ## Environment normalisation:
         
     | 
| 
      
 24 
     | 
    
         
            +
            /.bundle/
         
     | 
| 
      
 25 
     | 
    
         
            +
            /lib/bundler/man/
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            # for a library or gem, you might want to ignore these files since the code is
         
     | 
| 
      
 28 
     | 
    
         
            +
            # intended to run in multiple environments; otherwise, check them in:
         
     | 
| 
      
 29 
     | 
    
         
            +
            # Gemfile.lock
         
     | 
| 
      
 30 
     | 
    
         
            +
            # .ruby-version
         
     | 
| 
      
 31 
     | 
    
         
            +
            # .ruby-gemset
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
         
     | 
| 
      
 34 
     | 
    
         
            +
            .rvmrc
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            Gemfile.lock
         
     | 
| 
      
 37 
     | 
    
         
            +
            *.bundle
         
     | 
| 
      
 38 
     | 
    
         
            +
            *.so
         
     | 
| 
      
 39 
     | 
    
         
            +
            *.o
         
     | 
| 
      
 40 
     | 
    
         
            +
            *.a
         
     | 
| 
      
 41 
     | 
    
         
            +
            mkmf.log
         
     | 
    
        data/.ruby-version
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ruby-2.1.2
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/Guardfile
    ADDED
    
    
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2015 EagerELK
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
      
 13 
     | 
    
         
            +
            copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
      
 21 
     | 
    
         
            +
            SOFTWARE.
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2015 Jugrens du Toit
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            MIT License
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 6 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 7 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 8 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 9 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 10 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 11 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 14 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 17 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 18 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 19 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 20 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 21 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 22 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Elastic::Stats
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            TODO: Write a gem description
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                gem 'elastic-stats'
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                $ gem install elastic-stats
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            TODO: Write usage instructions here
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            1. Fork it ( https://github.com/eagerelk/elastic-stats-ruby/fork )
         
     | 
| 
      
 26 
     | 
    
         
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
      
 27 
     | 
    
         
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 28 
     | 
    
         
            +
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
      
 29 
     | 
    
         
            +
            5. Create a new Pull Request
         
     | 
    
        data/Rakefile
    ADDED
    
    
| 
         @@ -0,0 +1,31 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'elastic/stats/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = 'elastic-stats'
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = Elastic::Stats::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ['Jugrens du Toit']
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ['jrgns@jrgns.net']
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.summary    = 'An utility to fetch various statistics from Elasticsearch.'
         
     | 
| 
      
 12 
     | 
    
         
            +
              spec.homepage      = 'https://github.com/eagerelk/elastic-stats-ruby'
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.license       = 'MIT'
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0")
         
     | 
| 
      
 16 
     | 
    
         
            +
              spec.executables   = spec.files.grep(/^bin\//) { |f| File.basename(f) }
         
     | 
| 
      
 17 
     | 
    
         
            +
              spec.test_files    = spec.files.grep(/^(test|spec|features)\//)
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.require_paths = ['lib']
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              spec.add_development_dependency 'bundler', '~> 1.6'
         
     | 
| 
      
 21 
     | 
    
         
            +
              spec.add_development_dependency 'rspec'
         
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_development_dependency 'guard'
         
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_development_dependency 'guard-rspec'
         
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency 'rubocop'
         
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_development_dependency 'rake'
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_development_dependency 'webmock'
         
     | 
| 
      
 27 
     | 
    
         
            +
              spec.add_development_dependency 'codeclimate-test-reporter'
         
     | 
| 
      
 28 
     | 
    
         
            +
              spec.add_runtime_dependency 'hashie'
         
     | 
| 
      
 29 
     | 
    
         
            +
              spec.add_runtime_dependency 'statsample'
         
     | 
| 
      
 30 
     | 
    
         
            +
              spec.add_runtime_dependency 'elasticsearch'
         
     | 
| 
      
 31 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'elasticsearch'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Elastic
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Stats
         
     | 
| 
      
 5 
     | 
    
         
            +
                # Module to set up and manage the Elasticsearch client
         
     | 
| 
      
 6 
     | 
    
         
            +
                module ElasticClient
         
     | 
| 
      
 7 
     | 
    
         
            +
                  attr_writer :client
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  def client
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @client ||= Elasticsearch::Client.new client_options
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  def client_options
         
     | 
| 
      
 14 
     | 
    
         
            +
                    @client_options ||= default_options
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  def client_options=(options = {})
         
     | 
| 
      
 18 
     | 
    
         
            +
                    client_options.update(options)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  private
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  def default_options
         
     | 
| 
      
 24 
     | 
    
         
            +
                    {
         
     | 
| 
      
 25 
     | 
    
         
            +
                      url: ENV['ELASTICSEARCH_URL']
         
     | 
| 
      
 26 
     | 
    
         
            +
                    }
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,101 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'elastic/stats/elastic_client'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'hashie'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'statsample'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Elastic
         
     | 
| 
      
 6 
     | 
    
         
            +
              module Stats
         
     | 
| 
      
 7 
     | 
    
         
            +
                # Utility to determine the KolmogorovSmirnov difference between to sets of
         
     | 
| 
      
 8 
     | 
    
         
            +
                # data fetched from Elasticsearch
         
     | 
| 
      
 9 
     | 
    
         
            +
                class KS
         
     | 
| 
      
 10 
     | 
    
         
            +
                  include ElasticClient
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  attr_accessor :logger
         
     | 
| 
      
 13 
     | 
    
         
            +
                  attr_writer :debug, :query
         
     | 
| 
      
 14 
     | 
    
         
            +
                  attr_reader :indices, :to, :from, :span, :interval, :field
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  MULTIPLIERS = {
         
     | 
| 
      
 17 
     | 
    
         
            +
                    0.001 => 1.95,
         
     | 
| 
      
 18 
     | 
    
         
            +
                    0.005 => 1.73,
         
     | 
| 
      
 19 
     | 
    
         
            +
                    0.01 => 1.63,
         
     | 
| 
      
 20 
     | 
    
         
            +
                    0.025 => 1.48,
         
     | 
| 
      
 21 
     | 
    
         
            +
                    0.05 => 1.36,
         
     | 
| 
      
 22 
     | 
    
         
            +
                    0.10 => 1.22
         
     | 
| 
      
 23 
     | 
    
         
            +
                  }
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  # indices should include all possible indices.
         
     | 
| 
      
 26 
     | 
    
         
            +
                  def initialize(indices, options = {})
         
     | 
| 
      
 27 
     | 
    
         
            +
                    @indices  = indices
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                    options = default_options.update(options)
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                    @to       = options.delete(:to)
         
     | 
| 
      
 32 
     | 
    
         
            +
                    @span     = options.delete(:span)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    @interval = options.delete(:interval)
         
     | 
| 
      
 34 
     | 
    
         
            +
                    @field    = options.delete(:field)
         
     | 
| 
      
 35 
     | 
    
         
            +
                    @offset   = options.delete(:offset)
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                    @indices = [indices]  unless @indices.is_a? Array
         
     | 
| 
      
 38 
     | 
    
         
            +
                    @to      = @to.to_i   if @to.respond_to?(:to_i)
         
     | 
| 
      
 39 
     | 
    
         
            +
                    @from    = @to - @span
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  def fetch(confidence = 0.05)
         
     | 
| 
      
 43 
     | 
    
         
            +
                    current  = range(@from, @to)
         
     | 
| 
      
 44 
     | 
    
         
            +
                    previous = range(@from - @offset, @to - @offset)
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                    difference = Statsample::Test::KolmogorovSmirnov.new(
         
     | 
| 
      
 47 
     | 
    
         
            +
                      current, previous
         
     | 
| 
      
 48 
     | 
    
         
            +
                    ).d
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                    comparison = calculate(current, previous, confidence)
         
     | 
| 
      
 51 
     | 
    
         
            +
                    {
         
     | 
| 
      
 52 
     | 
    
         
            +
                      confidence: confidence, comparison: comparison,
         
     | 
| 
      
 53 
     | 
    
         
            +
                      difference: difference, different?: (difference > comparison)
         
     | 
| 
      
 54 
     | 
    
         
            +
                    }
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  def calculate(current, previous, confidence)
         
     | 
| 
      
 58 
     | 
    
         
            +
                    MULTIPLIERS[confidence] * Math.sqrt(
         
     | 
| 
      
 59 
     | 
    
         
            +
                      (
         
     | 
| 
      
 60 
     | 
    
         
            +
                        (current.count + previous.count).to_f /
         
     | 
| 
      
 61 
     | 
    
         
            +
                        (current.count * previous.count)
         
     | 
| 
      
 62 
     | 
    
         
            +
                      )
         
     | 
| 
      
 63 
     | 
    
         
            +
                    )
         
     | 
| 
      
 64 
     | 
    
         
            +
                  end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                  def range(from, to)
         
     | 
| 
      
 67 
     | 
    
         
            +
                    Hashie::Mash.new(
         
     | 
| 
      
 68 
     | 
    
         
            +
                      client.search index: indices.join(','), body: query(from, to)
         
     | 
| 
      
 69 
     | 
    
         
            +
                    ).aggregations.hits_per_minute.buckets.collect(&:doc_count)
         
     | 
| 
      
 70 
     | 
    
         
            +
                  end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                  def query(from, to)
         
     | 
| 
      
 73 
     | 
    
         
            +
                    @query = Hashie::Mash.new
         
     | 
| 
      
 74 
     | 
    
         
            +
                    @query.aggregations!.hits_per_minute!.date_histogram = {
         
     | 
| 
      
 75 
     | 
    
         
            +
                      field: field, interval: interval, min_doc_count: 0,
         
     | 
| 
      
 76 
     | 
    
         
            +
                      extended_bounds: {
         
     | 
| 
      
 77 
     | 
    
         
            +
                        min: (from * 1000),
         
     | 
| 
      
 78 
     | 
    
         
            +
                        max:   (to * 1000)
         
     | 
| 
      
 79 
     | 
    
         
            +
                      }
         
     | 
| 
      
 80 
     | 
    
         
            +
                    }
         
     | 
| 
      
 81 
     | 
    
         
            +
                    @query
         
     | 
| 
      
 82 
     | 
    
         
            +
                  end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                  def debug?
         
     | 
| 
      
 85 
     | 
    
         
            +
                    @debug ||= ENV['DEBUG']
         
     | 
| 
      
 86 
     | 
    
         
            +
                  end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                  private
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                  def default_options
         
     | 
| 
      
 91 
     | 
    
         
            +
                    {
         
     | 
| 
      
 92 
     | 
    
         
            +
                      to: Time.new.to_i,
         
     | 
| 
      
 93 
     | 
    
         
            +
                      span: (60 * 60 * 12),
         
     | 
| 
      
 94 
     | 
    
         
            +
                      interval: '1h',
         
     | 
| 
      
 95 
     | 
    
         
            +
                      field: '@timestamp',
         
     | 
| 
      
 96 
     | 
    
         
            +
                      offset: (60 * 60 * 24 * 7)
         
     | 
| 
      
 97 
     | 
    
         
            +
                    }
         
     | 
| 
      
 98 
     | 
    
         
            +
                  end
         
     | 
| 
      
 99 
     | 
    
         
            +
                end
         
     | 
| 
      
 100 
     | 
    
         
            +
              end
         
     | 
| 
      
 101 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,51 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'elastic/stats/elastic_client'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            # Testing class for the Elastic::Stats::ElasticClient module
         
     | 
| 
      
 5 
     | 
    
         
            +
            class ElasticClientTest
         
     | 
| 
      
 6 
     | 
    
         
            +
              include Elastic::Stats::ElasticClient
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            describe Elastic::Stats::ElasticClient do
         
     | 
| 
      
 10 
     | 
    
         
            +
              subject { ElasticClientTest.new }
         
     | 
| 
      
 11 
     | 
    
         
            +
              it 'allows the client to be set' do
         
     | 
| 
      
 12 
     | 
    
         
            +
                client = Object.new
         
     | 
| 
      
 13 
     | 
    
         
            +
                subject.client = client
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                expect(subject.client).to be client
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              it 'has sane default options' do
         
     | 
| 
      
 19 
     | 
    
         
            +
                expect(subject.client_options).to eq(
         
     | 
| 
      
 20 
     | 
    
         
            +
                  url: ENV['ELASTICSEARCH_URL']
         
     | 
| 
      
 21 
     | 
    
         
            +
                )
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              it 'allows the client options to be retrieved' do
         
     | 
| 
      
 25 
     | 
    
         
            +
                expect(subject.client_options).to eq(url: ENV['ELASTICSEARCH_URL'])
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              it 'allows the default client options to be added' do
         
     | 
| 
      
 29 
     | 
    
         
            +
                logger = Object.new
         
     | 
| 
      
 30 
     | 
    
         
            +
                options  = {
         
     | 
| 
      
 31 
     | 
    
         
            +
                  debug: true,
         
     | 
| 
      
 32 
     | 
    
         
            +
                  logger: logger
         
     | 
| 
      
 33 
     | 
    
         
            +
                }
         
     | 
| 
      
 34 
     | 
    
         
            +
                subject.client_options = options
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                options.update(url: ENV['ELASTICSEARCH_URL'])
         
     | 
| 
      
 37 
     | 
    
         
            +
                expect(subject.client_options).to eq options
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              it 'allows the default client options to be overriden' do
         
     | 
| 
      
 41 
     | 
    
         
            +
                logger = Object.new
         
     | 
| 
      
 42 
     | 
    
         
            +
                options  = {
         
     | 
| 
      
 43 
     | 
    
         
            +
                  debug: true,
         
     | 
| 
      
 44 
     | 
    
         
            +
                  logger: logger,
         
     | 
| 
      
 45 
     | 
    
         
            +
                  url: 'http://mytesturl.com:9200/'
         
     | 
| 
      
 46 
     | 
    
         
            +
                }
         
     | 
| 
      
 47 
     | 
    
         
            +
                subject.client_options = options
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                expect(subject.client_options).to eq options
         
     | 
| 
      
 50 
     | 
    
         
            +
              end
         
     | 
| 
      
 51 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,71 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'elastic/stats/ks'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'webmock'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            describe Elastic::Stats::KS do
         
     | 
| 
      
 6 
     | 
    
         
            +
              it 'has an array of indices' do
         
     | 
| 
      
 7 
     | 
    
         
            +
                ks = Elastic::Stats::KS.new('logstash-2015.12.12')
         
     | 
| 
      
 8 
     | 
    
         
            +
                expect(ks.indices).to be_a Array
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              it 'has sane defaults' do
         
     | 
| 
      
 12 
     | 
    
         
            +
                ks = Elastic::Stats::KS.new('logstash-2015.12.12')
         
     | 
| 
      
 13 
     | 
    
         
            +
                now = Time.new
         
     | 
| 
      
 14 
     | 
    
         
            +
                expect(ks.to).to be_within(2).of(now.to_i)
         
     | 
| 
      
 15 
     | 
    
         
            +
                expect(ks.from).to eq ks.to - (60 * 60 * 12)
         
     | 
| 
      
 16 
     | 
    
         
            +
                expect(ks.interval).to eq '1h'
         
     | 
| 
      
 17 
     | 
    
         
            +
                expect(ks.field).to eq '@timestamp'
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              it 'accepts various options' do
         
     | 
| 
      
 21 
     | 
    
         
            +
                now = Time.new - 120
         
     | 
| 
      
 22 
     | 
    
         
            +
                options = {
         
     | 
| 
      
 23 
     | 
    
         
            +
                  to: now,
         
     | 
| 
      
 24 
     | 
    
         
            +
                  span: (60 * 60 * 24),
         
     | 
| 
      
 25 
     | 
    
         
            +
                  interval: '5m',
         
     | 
| 
      
 26 
     | 
    
         
            +
                  field: '@mytimefield'
         
     | 
| 
      
 27 
     | 
    
         
            +
                }
         
     | 
| 
      
 28 
     | 
    
         
            +
                ks = Elastic::Stats::KS.new('logstash-2015.12.12', options)
         
     | 
| 
      
 29 
     | 
    
         
            +
                expect(ks.to).to eq now.to_i
         
     | 
| 
      
 30 
     | 
    
         
            +
                expect(ks.from).to eq(ks.to.to_i - (60 * 60 * 24))
         
     | 
| 
      
 31 
     | 
    
         
            +
                expect(ks.interval).to eq '5m'
         
     | 
| 
      
 32 
     | 
    
         
            +
                expect(ks.field).to eq '@mytimefield'
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              context 'fetch' do
         
     | 
| 
      
 36 
     | 
    
         
            +
                subject do
         
     | 
| 
      
 37 
     | 
    
         
            +
                  WebMock.stub_request(:get, 'http://localhost:9200/fake/_search')
         
     | 
| 
      
 38 
     | 
    
         
            +
                    .to_return(
         
     | 
| 
      
 39 
     | 
    
         
            +
                      body: fixture('successful_search.json'),
         
     | 
| 
      
 40 
     | 
    
         
            +
                      headers: { 'Content-Type' => 'text/json' }
         
     | 
| 
      
 41 
     | 
    
         
            +
                    )
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                  ks = Elastic::Stats::KS.new('fake')
         
     | 
| 
      
 44 
     | 
    
         
            +
                  ks.client_options = {
         
     | 
| 
      
 45 
     | 
    
         
            +
                    url: 'http://localhost:9200',
         
     | 
| 
      
 46 
     | 
    
         
            +
                    log: false
         
     | 
| 
      
 47 
     | 
    
         
            +
                  }
         
     | 
| 
      
 48 
     | 
    
         
            +
                  ks.fetch
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                it 'fetches the KS difference stat' do
         
     | 
| 
      
 52 
     | 
    
         
            +
                  expect(subject).to have_key :difference
         
     | 
| 
      
 53 
     | 
    
         
            +
                  expect(subject[:difference]).to eq 0
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                it 'fetches the KS different boolean' do
         
     | 
| 
      
 57 
     | 
    
         
            +
                  expect(subject).to have_key :different?
         
     | 
| 
      
 58 
     | 
    
         
            +
                  expect(subject[:different?]).to be false
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                it 'fetches the KS confidence level' do
         
     | 
| 
      
 62 
     | 
    
         
            +
                  expect(subject).to have_key :confidence
         
     | 
| 
      
 63 
     | 
    
         
            +
                  expect(subject[:confidence]).to eq 0.05
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                it 'fetches the KS comparison value' do
         
     | 
| 
      
 67 
     | 
    
         
            +
                  expect(subject).to have_key :comparison
         
     | 
| 
      
 68 
     | 
    
         
            +
                  expect(subject[:comparison]).to eq 0.9616652224137048
         
     | 
| 
      
 69 
     | 
    
         
            +
                end
         
     | 
| 
      
 70 
     | 
    
         
            +
              end
         
     | 
| 
      
 71 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {"aggregations": {"hits_per_minute": {"date_histogram": {"extended_bounds": {"max": 1424785374000,"min": 1424781774000},"field": "@timestamp","interval": "1m","min_doc_count": 0}}},"query": {"filtered": {"filter": {"bool": {"must": [{"range": {"@timestamp": {"from": 1424781774000,"to": 1424785374000}}}]}}}},"size": 0}
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {"_shards": {"failed": 0,"successful": 5,"total": 5},"aggregations": {"hits_per_minute": {"buckets": [{"doc_count": 0,"key": 1424781600000,"key_as_string": "2015-02-24T12:40:00.000Z"},{"doc_count": 3,"key": 1424781900000,"key_as_string": "2015-02-24T12:45:00.000Z"},{"doc_count": 1,"key": 1424782200000,"key_as_string": "2015-02-24T12:50:00.000Z"},{"doc_count": 0,"key": 1424782500000,"key_as_string": "2015-02-24T12:55:00.000Z"}]}},"hits": {"hits": [],"max_score": 0.0,"total": 4},"timed_out": false,"took": 2}
         
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'codeclimate-test-reporter'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'helpers/utility'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 4 
     | 
    
         
            +
            Bundler.setup
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            CodeClimate::TestReporter.start
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            RSpec.configure do |config|
         
     | 
| 
      
 9 
     | 
    
         
            +
              config.alias_example_to :fit, focus: true
         
     | 
| 
      
 10 
     | 
    
         
            +
              config.filter_run focus: true
         
     | 
| 
      
 11 
     | 
    
         
            +
              config.run_all_when_everything_filtered = true
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,247 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: elastic-stats
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: 
         
     | 
| 
      
 6 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 7 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Jugrens du Toit
         
     | 
| 
      
 9 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 10 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 11 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2015-03-08 00:00:00.000000000 Z
         
     | 
| 
      
 13 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 14 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 15 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 17 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 18 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 19 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 20 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 21 
     | 
    
         
            +
                    version: '1.6'
         
     | 
| 
      
 22 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 23 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 25 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 26 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 27 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 28 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 29 
     | 
    
         
            +
                    version: '1.6'
         
     | 
| 
      
 30 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 31 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 32 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 33 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 34 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 35 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 36 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 37 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 38 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 39 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 40 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 41 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 42 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 43 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 44 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 45 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 46 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 47 
     | 
    
         
            +
              name: guard
         
     | 
| 
      
 48 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 49 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 50 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 51 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 52 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 53 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 54 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 55 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 56 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 57 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 63 
     | 
    
         
            +
              name: guard-rspec
         
     | 
| 
      
 64 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 66 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 67 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 68 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 69 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 70 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 71 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 72 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 73 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 74 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 75 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 76 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 77 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 78 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 79 
     | 
    
         
            +
              name: rubocop
         
     | 
| 
      
 80 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 81 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 82 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 83 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 84 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 85 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 86 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 87 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 88 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 89 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 90 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 91 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 92 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 93 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 94 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 95 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 96 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 97 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 98 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 99 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 100 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 101 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 102 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 103 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 104 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 105 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 106 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 107 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 108 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 109 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 110 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 111 
     | 
    
         
            +
              name: webmock
         
     | 
| 
      
 112 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 113 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 114 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 115 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 116 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 117 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 118 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 119 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 120 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 121 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 122 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 123 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 124 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 125 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 126 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 127 
     | 
    
         
            +
              name: codeclimate-test-reporter
         
     | 
| 
      
 128 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 129 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 130 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 131 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 132 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 133 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 134 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 135 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 136 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 137 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 138 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 139 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 140 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 141 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 142 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 143 
     | 
    
         
            +
              name: hashie
         
     | 
| 
      
 144 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 145 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 146 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 147 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 148 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 149 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 150 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 151 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 152 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 153 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 154 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 155 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 156 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 157 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 158 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 159 
     | 
    
         
            +
              name: statsample
         
     | 
| 
      
 160 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 161 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 162 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 163 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 164 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 165 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 166 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 167 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 168 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 169 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 170 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 171 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 172 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 173 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 174 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 175 
     | 
    
         
            +
              name: elasticsearch
         
     | 
| 
      
 176 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 177 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 178 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 179 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 180 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 181 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 182 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 183 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 184 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 185 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 186 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 187 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 188 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 189 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 190 
     | 
    
         
            +
            description: 
         
     | 
| 
      
 191 
     | 
    
         
            +
            email:
         
     | 
| 
      
 192 
     | 
    
         
            +
            - jrgns@jrgns.net
         
     | 
| 
      
 193 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 194 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 195 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 196 
     | 
    
         
            +
            files:
         
     | 
| 
      
 197 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
      
 198 
     | 
    
         
            +
            - .ruby-version
         
     | 
| 
      
 199 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 200 
     | 
    
         
            +
            - Guardfile
         
     | 
| 
      
 201 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 202 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 203 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 204 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 205 
     | 
    
         
            +
            - elastic-stats.gemspec
         
     | 
| 
      
 206 
     | 
    
         
            +
            - lib/elastic/stats.rb
         
     | 
| 
      
 207 
     | 
    
         
            +
            - lib/elastic/stats/elastic_client.rb
         
     | 
| 
      
 208 
     | 
    
         
            +
            - lib/elastic/stats/ks.rb
         
     | 
| 
      
 209 
     | 
    
         
            +
            - lib/elastic/stats/version.rb
         
     | 
| 
      
 210 
     | 
    
         
            +
            - spec/elastic/stats/elastic_client_spec.rb
         
     | 
| 
      
 211 
     | 
    
         
            +
            - spec/elastic/stats/ks_spec.rb
         
     | 
| 
      
 212 
     | 
    
         
            +
            - spec/fixtures/basic_search_request.json
         
     | 
| 
      
 213 
     | 
    
         
            +
            - spec/fixtures/successful_search.json
         
     | 
| 
      
 214 
     | 
    
         
            +
            - spec/helpers/utility.rb
         
     | 
| 
      
 215 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 216 
     | 
    
         
            +
            homepage: https://github.com/eagerelk/elastic-stats-ruby
         
     | 
| 
      
 217 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 218 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 219 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 220 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 221 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 222 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 223 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 224 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 225 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 226 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 227 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 228 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 229 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 230 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 231 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 232 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 233 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 234 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 235 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 236 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 237 
     | 
    
         
            +
            rubygems_version: 1.8.23
         
     | 
| 
      
 238 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 239 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 240 
     | 
    
         
            +
            summary: An utility to fetch various statistics from Elasticsearch.
         
     | 
| 
      
 241 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 242 
     | 
    
         
            +
            - spec/elastic/stats/elastic_client_spec.rb
         
     | 
| 
      
 243 
     | 
    
         
            +
            - spec/elastic/stats/ks_spec.rb
         
     | 
| 
      
 244 
     | 
    
         
            +
            - spec/fixtures/basic_search_request.json
         
     | 
| 
      
 245 
     | 
    
         
            +
            - spec/fixtures/successful_search.json
         
     | 
| 
      
 246 
     | 
    
         
            +
            - spec/helpers/utility.rb
         
     | 
| 
      
 247 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     |