Sha256: 50a8d023475e494d1125f464cd99d2d8d0dbc5c1e9cf06c67262c2b58d58e02a
Contents?: true
Size: 1.98 KB
Versions: 1
Compression:
Stored size: 1.98 KB
Contents
require 'test_helper' class DslTest < ActiveSupport::TestCase test 'search' do seed = rand days = [1,2,3] opens_at = Time.now.to_i closes_at = (Time.now + 1.day).to_i assert_equal( { query: { function_score: { functions: [ { random_score: { seed: seed } }, { weight: 400, filter: { bool: { must: [ { term: {} } ] } } } ] }, query: { filtered: { filter: { bool: { should: [ { term: { :'schedules.days' => days } } ], must: [ { range: { :'schedules.opens_at' => { lte: opens_at } } } ], must_not: [] } } } } }, size: {} }, build_request do query do function_score do functions do random_score do seed seed end filter weight: 400 do bool do must do term end end end end end query do filtered do filter do bool do should do term 'schedules.days' => days end must do range 'schedules.opens_at' do lte opens_at end end must_not do end end end end end end size end ) end private def build_request(&block) Indices::Dsl::Search.new(&block).to_h end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
indices-0.0.1 | test/dsl_test.rb |