Can't get hits.total when using filter_path
See original GitHub issueI’m using filter_path to filter the response on my aggregations, but I’m also interested in knowing the total number of hits for the query. For that, I’m adding hits.total
to the filter_path list parameter.
The result object looks as expected:
ipdb> dir(result)
['aggregations', 'hits']
However, when I try to access the field in the result object, a KeyError exception is raised:
ipdb> result.hits
*** KeyError: 'hits'
Although if I inspect the result object, I see the total is there:
ipdb> result.__dict__['_d_']['hits']
{'total': 207}
Is there a way I can access this path? Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Unable to use Filter_Path with NEST - ElasticSearch 5.0
On using Filter_Path to reduce the metadata returned from Elasticsearch, I get the following error: : 'Method not found: 'Elasticsearch.Net.
Read more >Common options | Elasticsearch Guide [8.5] | Elastic
This parameter takes a comma separated list of filters expressed with the dot notation: GET /_search?q=kimchy&filter_path=took,hits.hits._id,hits.hits.
Read more >Elasticsearch Source Filtering, Stored Fields, Fields ... - Opster
When performing a search request, the response returned contains by default an array of 10 hits which include the _source field. The _source...
Read more >Elasticsearch Report Helper — Indicia 8.9 documentation
[source] @id=grid-data @filterPath=hits.total,hits.hits. ... are multiple queries issued by a page, then they won't all get refreshed on the same page hit.
Read more >In Angular ej2 file manager i am unable to get folder path in ...
Query1- fetching file path. You can fetch the file/folder path by using filter path and name property in menuClick event argument.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jzbahrai sure, you should add it to the search object params:
Hey where did you add the filter_path to the request body? This says to add it in https://github.com/elastic/elasticsearch-py/blob/fc251751302da1b43a7789a402b03d87492c1227/docs/api.rst, but I can’t do it to the dsl.Search object. Can you point me to where you would do it for the dsl? Thanks! @jminuscula