在过去的一个小时里,我一直在尝试为多重增强查询找到正确的格式,有人可以帮助我正确地编写此格式吗?本质上,它是一个可以多次执行以下操作的查询.
i've been trying to find the right format for a mutliple boost query for the last hour, could someone assist me in writing this correctly? essentially it is a single query that can do the below many times.
这有效:
{ "query": { "match" : { "title": { "query": "brain", "boost": 2 } } } }这是我要实现的目标,但是没有用.在标题中搜索一个正常术语,在标题中优先搜索另外两个术语.
This is what i am trying to achieve but does not work. One normal term to search in title and two other boosted terms to also prioritise in title.
{ "query": { "match" : { "title": { "query": "neuron", }, "title": { "query": "brain", "boost": 2 }, "query": "birdsong", "boost": 3 } } } }我想澄清的另一件事是:
Another thing i'd like to clarify is:
为了使ElasticSearch能够从 Web应用程序,它们必须作为Post HTTP请求提交?
In order for ElasticSearch to understand queries like the above from a web application they must be submitted as a Post HTTP request?
推荐答案
您需要像这样发出bool/should查询:
You need to issue a bool/should query like this:
POST index/_search { "query": { "bool": { "should": [ { "match": { "title": { "query": "neuron" } } }, { "match": { "title": { "query": "brain", "boost": 2 } } }, { "match": { "title": { "query": "birdsong", "boost": 3 } } } ] } } }发送查询时,接受GET和POST.
Both GET and POST are accepted when sending a query.
更多推荐
Elasticsearch多个术语可以促进
发布评论