elasticsearch 查询中的弹性搜索和排序
我想在弹性搜索查询中使用
elasticsearch 查询中的弹性搜索和排序,
elasticsearch,
elasticsearch,我想在弹性搜索查询中使用ORing和ANDing。我做了父子映射。我将查询用作: { "from" : 0, "size" : 100, "query": { "bool": { "should": [ { "query": { "match_phrase": { "question_title": {
ORing
和ANDing
。我做了父子映射。我将查询用作:
{
"from" : 0, "size" : 100,
"query": {
"bool": {
"should": [
{
"query": {
"match_phrase": {
"question_title": {
"query": 'searchKey',
"slop": 3
}
}
}
},
{
"query": {
"has_parent": {
"type": "question_data",
"query": {
"match_phrase": {
"question_title": {
"query": 'searchKey',
"slop": 3
}
}
}
}
}
}
]
}
}
}
提前感谢..或者关于什么?你能分享你的模式和你想要实现的目标的更详细的解释吗?如果我把搜索键改为“宝宝哭”。我想得到标题包含“baby crying”字符串的第一个记录,然后是标题包含“baby or crying”单词的记录,就像我想要的结果一样。我怎样才能查询呢?假设我想搜索字符串“baby cry”。我只想得到排序结果:1包含两个单词的数据。2之后的数据,其中包含任何一个。