如何在 elasticsearch 1.4.5 中使用 must filter with range 和 terms
How to use must filter with range and terms in elasticsearch 1.4.5
我必须找到从 "today" 开始的数据,并且它的 "displaystatus" 必须为零。我正在使用它,但它也会 returns 显示状态为 1 的文档。
$searchParams['index'] = 'events';
$searchParams['type'] = 'couchbaseDocument';
$searchParams['from'] = 0;
$searchParams['size'] = 1000;
$searchParams['body']['query']['filtered']['filter']['bool']['must'][]['range']['starttimestamp']['from'] = $today;
$searchParams['body']['query']['filtered']['filter']['bool']['must'][]['term']['displaystatus'] = 0;
$searchParams['body']['query']['filtered']['filter']['bool']['must'][]['terms']['cat_id'] = $interestIdArray;
我不确定 python 但像这样
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"range": {
"FIELD": {
"gte": ,
"lte":
}
}
},
{
"term": {
"FIELD": "VALUE"
}
},
{
"term": {
"FIELD": "VALUE"
}
}
]
}
}
}
}
}
应该会很神奇。
我必须找到从 "today" 开始的数据,并且它的 "displaystatus" 必须为零。我正在使用它,但它也会 returns 显示状态为 1 的文档。
$searchParams['index'] = 'events';
$searchParams['type'] = 'couchbaseDocument';
$searchParams['from'] = 0;
$searchParams['size'] = 1000;
$searchParams['body']['query']['filtered']['filter']['bool']['must'][]['range']['starttimestamp']['from'] = $today;
$searchParams['body']['query']['filtered']['filter']['bool']['must'][]['term']['displaystatus'] = 0;
$searchParams['body']['query']['filtered']['filter']['bool']['must'][]['terms']['cat_id'] = $interestIdArray;
我不确定 python 但像这样
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"range": {
"FIELD": {
"gte": ,
"lte":
}
}
},
{
"term": {
"FIELD": "VALUE"
}
},
{
"term": {
"FIELD": "VALUE"
}
}
]
}
}
}
}
}
应该会很神奇。