【发布时间】:2016-01-28 11:36:49
【问题描述】:
我想知道是否有可能组合两种查询类型,在我的情况下,我需要一个 queryString 和过滤查询,每个都必须在不同的字段上进行操作。
过滤后的查询获取$postids中的所有记录
$postids:multiple post_id 的值
查询字符串是在文本中搜索一个单词
目前我需要两个请求来存档:
查询过滤:
GET /myindex1/tweecoms/_search
{
"query" : {
"filtered" : {
"filter" : {
"terms" : {
"post_id" : ['.$postids.']
}
}
}
}
query String:
GET /myindex1/tweecoms/_search{
"query": {
"query_string": {
"query": "*' . $sujet . '*",
"lenient": true
}
}
}
我试着把它结合起来
GET /myindex1/tweecoms/_search
{
"query": {
"bool": {
"should": [
{
"query_string": {
"query": "hhhh",
"lenient": true
}
},
{
"filtered" : {
"filter" : {
"terms" : {
"post_id" : [0,157]
}
}
}
}
]
}
}
}`
但我尝试只运行查询字符串
【问题讨论】:
标签: php search elasticsearch bigdata