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.

Can't get when using filter_path

See original GitHub issue

I’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 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:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

jminusculacommented, Apr 3, 2017

@jzbahrai sure, you should add it to the search object params:

            filter_path=['', 'aggregations.my_aggregation', 'aggregations.myagg2.doc_count'] 
jzbahraicommented, Apr 3, 2017

Hey where did you add the filter_path to the request body? This says to add it in, 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

Read more comments on GitHub >

github_iconTop 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,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 >

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 Post

No results found

github_iconTop Related Hashnode Post

No results found