Elasticsearch多个术语可以促进

编程入门 行业动态 更新时间:2024-10-26 20:32:06
本文介绍了Elasticsearch多个术语可以促进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在过去的一个小时里,我一直在尝试为多重增强查询找到正确的格式,有人可以帮助我正确地编写此格式吗?本质上,它是一个可以多次执行以下操作的查询.

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多个术语可以促进

本文发布于:2023-11-08 11:44:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1569278.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   术语   Elasticsearch

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!