目前在我的映射(ES 6.2)中,我有两个属性:
在我的PostgreSQL中,我有一个处理这些数据的函数,并返回截止日期是否已过期,如下面的代码所示:
IF (deadline IS NULL) THEN
--WITHOUT DEADLINE
RETURN 2;
ELSIF
(
((current_stats IN (4, 5)) AND (deadline >= current_timestamp))
)
THEN
--UNEXPIRED DEADLINE
RETURN 1;
ELSIF
(
((current_stats NOT IN (4, 5)) AND (deadline < datahora))
)
THEN
--EXPIRED DEADLINE
RETURN 0;
ELSIF
(
((current_stats IN (4, 5)) AND (deadline < current_timestamp))
)
THEN
--EXPIRED DEADLINE
RETURN 0;
ELSIF
(
((current_stats NOT IN (4, 5)) AND (deadline >= current_timestamp))
)
THEN
--UNEXPIRED DEADLINE
RETURN 1;
ELSIF
(
((current_stats NOT IN (4, 5)) AND (deadline < current_timestamp))
)
THEN
--EXPIRED DEADLINE
RETURN 0;
END IF;
是否可以在ElasticSearch中创建类似的东西来使用函数查找数据?
示例:
"bool": {
"term": [
{
function_deadline_ok(deadline, current_stats): 1
}
]
}