Search 多字段弹性搜索查询字符串用于构建字符搜索
我是elasticsearch的新手,我正在尝试用一个查询来解决一些问题。 在下面的查询中,我正在尝试实现基于字符ngram的elasticsearch查询,该查询还将处理拼写更正Search 多字段弹性搜索查询字符串用于构建字符搜索,search,
elasticsearch,full-text-search,querydsl,Search,
elasticsearch,Full Text Search,Querydsl,我是elasticsearch的新手,我正在尝试用一个查询来解决一些问题。 在下面的查询中,我正在尝试实现基于字符ngram的elasticsearch查询,该查询还将处理拼写更正 排序选项取决于用户设置的语言首选项 在查询中,单词“hello there”被分解为大小为3-5的字符和标记本身 模糊性查询没有按照我的预期工作,所以我放弃了它 “类型”是索引结果的不同媒体类型。在查询中也请求了类型筛选器 我的问题如下- { "from": 0, "query": {
- 排序选项取决于用户设置的语言首选项
- 在查询中,单词“hello there”被分解为大小为3-5的字符和标记本身
- 模糊性查询没有按照我的预期工作,所以我放弃了它
- “类型”是索引结果的不同媒体类型。在查询中也请求了类型筛选器
{
"from": 0,
"query": {
"filtered": {
"filter": {
"or": [
{
"term": {
"type": 0
}
}
]
},
"query": {
"query_string": {
"fields": [
"tags^10",
"edge_ngrams^5",
"ngram5^3",
"ngram4^2",
"ngram3"
],
"query": "hello there hel ell llo hell ello the her ere ther here"
}
}
}
},
"size": 20,
"sort": [
"_score",
{
"english": "desc"
},
{
"hindi": "desc"
},
{
"global": "desc"
},
{
"popularity": "desc"
}
]
}
当我查询像“hello”和ngrams这样的单个单词时,查询(我认为)效果很好,但如果我使用短语“hello there”和ngrams,结果更偏向于一个单词,并且包含这两个单词的结果不会浮动
展望未来