Sha256: c0894ae0839ccee2738291503d6d99b9eb5e83a18c515b9849d04fd4e73023dd

Contents?: true

Size: 1.76 KB

Versions: 7

Compression:

Stored size: 1.76 KB

Contents

describe Elastic::AppSearch::Client::Analytics do
  include_context 'App Search Credentials'
  include_context 'Test Engine'

  let(:client) { Elastic::AppSearch::Client.new(client_options) }

  context '#get_top_clicks_analytics' do
    subject do
      client.get_top_clicks_analytics(
        engine_name,
        :query => 'cats',
        :page => {
          :size => 20,
        },
        :filters => {
          :date => {
            :from => Time.now.iso8601,
            :to => Time.now.iso8601
          }
        }
      )
    end

    it 'will query for analytics' do
      expect(subject['results']).to(eq([]))
    end
  end

  context '#get_top_queries_analytics' do
    subject do
      client.get_top_queries_analytics(
        engine_name,
        :page => {
          :size => 20
        },
        :filters => {
          :date => {
            :from => Time.now.iso8601,
            :to => Time.now.iso8601
          }
        }
      )
    end

    it 'will query for analytics' do
      expect(subject['results']).to(eq([]))
    end
  end

  context '#get_count_analytics' do
    let(:from) { Time.now.iso8601 }
    let(:to) { Time.now.iso8601 }

    subject do
      client.get_count_analytics(
        engine_name,
        :filters => {
          :all => [
            {
              :tag => ['mobile', 'web']
            }, {
              :query => 'cats'
            }, {
              :document_id => '163'
            }, {
              :date => {
                :from => from,
                :to => to
              }
            }
          ]
        },
        :interval => 'hour'
      )
    end

    it 'will query for analytics' do
      expect(subject['results'][0]['clicks']).to(eq(0))
      expect(subject['results'][0]['queries']).to(eq(0))
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
elastic-app-search-7.10.0 spec/analytics_spec.rb
elastic-app-search-7.9.0 spec/analytics_spec.rb
elastic-app-search-7.8.0 spec/analytics_spec.rb
elastic-app-search-7.7.0 spec/analytics_spec.rb
elastic-app-search-7.6.0 spec/analytics_spec.rb
elastic-app-search-7.5.0 spec/analytics_spec.rb
elastic-app-search-7.4.1 spec/analytics_spec.rb