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.

How to create a boosting query

See original GitHub issue

I was going through the documentation but i was not able to find and documentation regarding how to build a boosting query:

i was able to construct it till here:

Q('boosting', positive=Q("multi_match", query="hola", fields=["name", "family_name"], type="most_fields"),
              negative=F("missing", field="uid"))

But the negative part is not working. Anyone has any clue how to do this?

Another problem is how to have array of positive / negative boosters.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
honzakralcommented, Feb 21, 2016

The dsl just converts the keyword arguments to keys in the json body, that’s all it does.

s = Search()

s = s.query(
  Q(
    "multi_match",
    query="...",
    fields=['product_name', "short_name"],
    boost=2
  ) | Q(
    'match',
    product_pinyin={'query': '...', 'boost': 1}
  )
)

Hope this helps

0reactions
levylllcommented, Mar 4, 2016

Oh,it’s very sorry that I found your email was isolated by my mailbox. Thank you for your consideration. Now I use the json format to solve my problem. If I get into troubles when I add your api in my system, I would ask you for help. Thanks again! Wish you best!

在 2016年3月3日,下午10:28,Honza Král notifications@github.com 写道:

There is no reaction for over a week so I will assume the last comment resolved this issue, please reopen if you need additional info. Thanks!

— Reply to this email directly or view it on GitHub https://github.com/elastic/elasticsearch-dsl-py/issues/336#issuecomment-191784069.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Boosting query | Elasticsearch Guide [8.5] | Elastic
Returns documents matching a positive query while reducing the relevance score of documents that also match a negative query. You can use the...
Read more >
Elasticsearch Boosting Query - Opster
Boosting queries return documents that match a positive query while decreasing the relevance score of documents matching the negative query. You can demote ......
Read more >
Boosting in Elasticsearch - Stack Overflow
Query time boost allows you to give more weight to one query than to another. For instance, let's say you are querying the...
Read more >
Boosting - Coding Explained -
This article explains how to boost terms and query clauses when searching in Elasticsearch. When searching for multiple terms, ...
Read more >
6.3. Boosting | Elasticsearch in Action
With the match query, you can boost the query by using the additional boost parameter, as shown in the next listing. Boosting the...
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