[英]Elasticsearch indexing Postgres int4range range
I have a range field named salary
of type int4range
for my Postgres database. 我有一个名为范围字段salary
类型int4range
我的Postgres数据库。 I intend to index this field to Elasticsearch. 我打算将此字段索引到Elasticsearch。 May I know what is the recommended way to do this? 我可以知道推荐的方法吗? From what I know there is no range type in Elasticsearch, only integer. 据我所知,Elasticsearch中没有范围类型,只有整数。
So, do I need to parse int4range's begin and end boundary individually and index them as salary_begin
and salary_end
and while searching use the range filter, or is there a better approach? 因此,我是否需要分别解析int4range的开始和结束边界并将它们索引为salary_begin
和salary_end
并在搜索时使用范围过滤器,还是有更好的方法?
Postgres ==> int4range ==> salary (only 1 field in PSQL)
Elasticsearch ==> integer ==> [salary_begin, salary_end] (2 index fields in ES)
No need to parse anything. 无需解析任何内容。 Just use lower()
and upper()
: 只需使用lower()
和upper()
:
http://www.postgresql.org/docs/current/static/functions-range.html http://www.postgresql.org/docs/current/static/functions-range.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.