Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct placement of nested query #4

Merged
merged 2 commits into from Oct 18, 2013
Merged

Correct placement of nested query #4

merged 2 commits into from Oct 18, 2013

Conversation

ebarendt
Copy link
Collaborator

Had the 'nested' value at the wrong level in the query. Tested and fixed.

@@ -2,7 +2,11 @@ module Arelastic
module Facets
class Nested < Struct.new :path, :facet
def as_elastic
facet.as_elastic.merge("nested" => path)
original = facet.as_elastic
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if Facets::Facet implemented as_elastic like this?

def as_elastic
  {name => as_elastic_facet}
end

And then inheriting facets implement as_elastic_facet.

@ebarendt
Copy link
Collaborator Author

@matthuhiggins ready to go now

@@ -1,17 +1,16 @@
module Arelastic
module Facets
class Histogram < Arelastic::Facets::Facet
attr_accessor :name, :options
attr_accessor :options

def initialize name, options
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea kind of sucks for this part, because all the inheriting classes still define initialize. Muuuurging anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it better anyway. Not as clean as < Struct, but still better than
munging a hash of a certain format.

On Fri, Oct 18, 2013 at 1:10 PM, Matthew Higgins
notifications@github.comwrote:

In lib/arelastic/facets/histogram.rb:

@@ -1,17 +1,16 @@
module Arelastic
module Facets
class Histogram < Arelastic::Facets::Facet

  •  attr_accessor :name, :options
    
  •  attr_accessor :options
    
    • def initialize name, options

My idea kind of sucks for this part, because all the inheriting classes
still define initialize. Muuuurging anyway.


Reply to this email directly or view it on GitHubhttps://github.com//pull/4/files#r7072610
.

matthuhiggins added a commit that referenced this pull request Oct 18, 2013
Correct placement of nested query
@matthuhiggins matthuhiggins merged commit a30cdbc into matthuhiggins:master Oct 18, 2013
@matthuhiggins
Copy link
Owner

arelastic-0.4.7.gem now on rubygems

@matthuhiggins
Copy link
Owner

I think you still need to fix Filter#nested.

@ebarendt
Copy link
Collaborator Author

Yep. Didn't have ES docs with me on the plane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants