cirandas.net

ref: master

plugins/elasticsearch/lib/nested_helper/profile.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module NestedProfile

  def self.hash
    {
      :id             => { type: :integer },
      :visible        => { type: :boolean },
      :public_profile => { type: :boolean }
    }
  end

  def self.filter
    {
      query: {
        nested: {
          path: "profile",
          query: {
            bool: {
              must:[
                { term: { "profile.visible" => true } },
                { term: { "profile.public_profile" => true } }
              ],
            }
          }
        }
      }
    }
  end

end