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.

dsl doesn't parser filter correctly

See original GitHub issue

Hello, I have these code:

self.search = self.search.filter(
                'geo_polygon', location={'points': polygon_coordinates}
            )

and these result:

Exception Value: filter() got an unexpected keyword argument 'location'

I have these location index, on _mappings

{
    "myindex_data": {
        "mappings": {
            "my_data": {
                "properties": {
                   "location": {
                        "type": "geo_point"
                    }
                }
            }
        }
    }

So, my issue is: there’s issue on DSL, work with geo_polygon or my command is incorrect?

Thanks!

Regards!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
honzakralcommented, Aug 3, 2017

FacetedSearch has a Search object stored as self._s. In your case you want to, however, override the search method and add any logic in there:

def search(self):
    s = super(MyFacetedSearch, self).search()
    if self.geo_param:
        s = s.filter('geo_polygon', ...)
    return s

What you are doing is overriding a built-in search method with an instance of Search which is not supported and cannot be picked up by the rest of the FacetedSearch code.

Hope this helps

0reactions
fellipehcommented, Aug 18, 2017

Hi @HonzaKral

any news about these?

Getting the query generated by DSL, I can’t get any record… but if I made the query manually and send to ES, I get records…

maybe DSL is put extra params that prevent the record shows up?

thanks again

Read more comments on GitHub >

github_iconTop Results From Across the Web

Elasticsearch DSL syntax for filter terms - Stack Overflow
I've got an elastic search query that works with a multi_match and range filter but I can't work out the correct syntax for...
Read more >
Writing Custom Spring Cloud Gateway Filters - Baeldung
In this tutorial, we'll learn how to write custom Spring Cloud Gateway filters. We introduced this framework in our previous post, ...
Read more >
Query string query | Elasticsearch Guide [8.5] | Elastic
Returns documents based on a provided query string, using a parser with a strict syntax. This query uses a syntax to parse and...
Read more >
Search DSL — Elasticsearch DSL 7.2.0 documentation
The Search object represents the entire search request: queries; filters; aggregations; sort; pagination; additional parameters; associated client. The API is ...
Read more >
A Peggy.js Tutorial - Strumenta - Federico Tomassetti
In fact, having a separate lexer means that we can filter out some “noise” so that the parser doesn't have to deal with...
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