question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

0 hits from FacetedSearch when not specifying doc_types

See original GitHub issue

I’m trying something simple to see if I can get it working: (I’m on 5.1)

class DogSearch(FacetedSearch):
    fields = ['fleas']
    facets = {
        'fleas': TermsFacet(field='fleas'),
    }
    index = [settings.ASSOCIATIONS_INDEX_NAME]

rs = DogSearch()
response = rs.execute()

But I’m getting 0 hits when I know there are lots of results.

Here’s what it’s generating when I run it:

{"query": {"match_all": {}}, "aggs": {"_filter_fleas": {"filter": {"match_all": {}}, "aggs": {"fleas": {"terms": {"field": "fleas"}}}}}, "highlight": {"fields": {"fleas": {}}}}

{"took":3,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]},"aggregations":{"_filter_fleas":{"doc_count":0,"fleas":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]}}}}

Could something be going wrong in the query, or am I just using this wrong?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
honzakralcommented, Nov 6, 2017

use None for doc_types then, I will change it to be the default

0reactions
OskarPerssoncommented, Nov 6, 2017

Oh okay, is there an alternative I can use to target all types without manually listing them?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Faceted Search and Customized Search Filtering
Faceted search is a search mechanism that allows search results to be narrowed down by applying a set of filters to the result...
Read more >
python - Elasticsearch boolean facets returned as wrong type
What am I doing wrong here? How can we make the facet values for a Boolean field deserialize correctly in the facets, as...
Read more >
Getting and Using Facet Information in Amazon CloudSearch
You can get facet information for any facet-enabled field by specifying the facet.FIELD parameter in your search request. By default, Amazon CloudSearch returns ......
Read more >
Elasticsearch DSL Documentation - Read the Docs
Pre-built Faceted Search. If you have your Documents defined you can very easily create a faceted search class to simplify searching and.
Read more >
Faceted Search — Elasticsearch DSL 7.4.0 documentation
RangeFacet: allows you to define your own ranges for a numerical fields: RangeFacet(field="comment_count", ranges=[("few", (None, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found