Comments (8)
Hi, you named your facet commercial_type
, not tags
, see https://gist.github.com/e2811c9f99b9be2b4f67
See also the docs on ES facets, http://www.elasticsearch.org/guide/reference/api/search/facets/index.html!
from retire.
Hi. I fixed that... but i noticed that you don't need results anymore. So the example should be:
s.facets['commercial_type']['terms'].each do |f|
puts "#{f['term'].ljust(10)} #{f['count']}"
end
The above works. I think the documentation needs some updating?
Thanks for your help!
from retire.
Well, it's probably just some side effect, it should be accessed via results
, see the integration tests...
from retire.
Strange though.. when i looked at the code, it makes sense that you would not need results. The search method returns Results::Collection.
def search(indices, options={}, &block)
if block_given?
Search::Search.new(indices, options, &block).perform
else
payload = case options
when Hash then options.to_json
when String then options
else raise ArgumentError, "Please pass a Ruby Hash or String with JSON"
end
response = Configuration.client.post( "#{Configuration.url}/#{indices}/_search", payload)
json = MultiJson.decode(response.body)
results = Results::Collection.new(json, options)
end
Results::Collection has a facets attr_reader
module Tire
module Results
class Collection
include Enumerable
include Pagination
attr_reader :time, :total, :options, :results, :facets
from retire.
Yeah, but that's precisely why I wonder that you'd not need accessing it via the results
method :)
from retire.
Not sure what you mean... the search method returns Results::Collection and there is a method on their facets.
Results::Collection#facets
Why would we need to call Results::Collection#results#facets?
thx
from retire.
Sorry, not enough time right now, you're right.
from retire.
Cool.. just as long as i am not going crazy. Thanks!
from retire.
Related Issues (20)
- empty array HOT 2
- Elasticsearch 1.2.1, empty hash should be removed. HOT 5
- T
- Can I use regexp query via tire? HOT 1
- Persistence module does not provide updating a record. HOT 2
- "uninitialized constant" error on import rake task HOT 3
- Sort by field value other model (table)
- How can we use tire with multitenant app?
- Timeout option on activerecord? HOT 1
- Boost hits based on date HOT 2
- is there a way to use tire with zeus-parallel_tests?
- Custom Mapping on Hstore Columns
- Elasticsearch(0.90.9) failed to download 230K records(~80mb), with Tire gem(0.4.2).Below was the error message
- Elasticsearch(0.90.9) failed to download 230K records(~80mb), with Tire gem(0.4.2).Below was the error message
- import:all tasks: models load HOT 1
- Regarding nested query
- Support to `search_type: scan` HOT 1
- Ordering doesn't work without RoR shutdown HOT 1
- d
- Querying Association Trouble? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from retire.