Class: Elasticsearch::DSL::Search::Filters::GeohashCell

Inherits:
Object
  • Object
show all
Includes:
BaseComponent
Defined in:
lib/elasticsearch/dsl/search/filters/geohash_cell.rb

Overview

A filter which translates lat/lon values into a geohash with the specified precision and returns all documents which fall into it

See the integration test for a working example.

Examples:


search do
  query do
    filtered do
      filter do
        geohash_cell :location do
          lat '50.090223'
          lon '14.399590'
          precision '5km'
          neighbors true
        end
      end
    end
  end
end

See Also:

Instance Method Summary collapse

Methods included from BaseComponent

included

Constructor Details

#initialize(*args, &block) ⇒ GeohashCell

Returns a new instance of GeohashCell.



42
43
44
45
# File 'lib/elasticsearch/dsl/search/filters/geohash_cell.rb', line 42

def initialize(*args, &block)
  super
  @hash[self.name.to_sym] = { @args => {} } unless @args.empty?
end