esquery

description

Syntax

boolean esquery(varchar field, varchar QueryDSL)

通过esquery(field, QueryDSL)函数将一些无法用sql表述的query如match_phrase、geoshape等下推给Elasticsearch进行过滤处理. esquery的第一个列名参数用于关联index,第二个参数是ES的基本Query DSL的json表述,使用花括号{}包含,json的root key有且只能有一个, 如match_phrase、geo_shape、bool等

example

  1. match_phrase查询:
  2. select * from es_table where esquery(k4, '{
  3. "match_phrase": {
  4. "k4": "doris on es"
  5. }
  6. }');
  7. geo相关查询:
  8. select * from es_table where esquery(k4, '{
  9. "geo_shape": {
  10. "location": {
  11. "shape": {
  12. "type": "envelope",
  13. "coordinates": [
  14. [
  15. 13,
  16. 53
  17. ],
  18. [
  19. 14,
  20. 52
  21. ]
  22. ]
  23. },
  24. "relation": "within"
  25. }
  26. }
  27. }');

keywords

  1. esquery