limitations.asciidoc 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[sql-limitations]]
  4. == SQL Limitations
  5. beta[]
  6. [float]
  7. === Nested fields in `SYS COLUMNS` and `DESCRIBE TABLE`
  8. {es} has a special type of relationship fields called `nested` fields. In {es-sql} they can be used by referencing their inner
  9. sub-fields. Even though `SYS COLUMNS` and `DESCRIBE TABLE` will still display them as having the type `NESTED`, they cannot
  10. be used in a query. One can only reference its sub-fields in the form:
  11. [source, sql]
  12. --------------------------------------------------
  13. [nested_field_name].[sub_field_name]
  14. --------------------------------------------------
  15. For example:
  16. [source, sql]
  17. --------------------------------------------------
  18. SELECT dep.dep_name.keyword FROM test_emp GROUP BY languages;
  19. --------------------------------------------------
  20. [float]
  21. === Multi-nested fields
  22. {es-sql} doesn't support multi-nested documents, so a query cannot reference more than one nested field in an index.
  23. This applies to multi-level nested fields, but also multiple nested fields defined on the same level. For example, for this index:
  24. [source, sql]
  25. ----------------------------------------------------
  26. column | type | mapping
  27. ----------------------+---------------+-------------
  28. nested_A |STRUCT |NESTED
  29. nested_A.nested_X |STRUCT |NESTED
  30. nested_A.nested_X.text|VARCHAR |KEYWORD
  31. nested_A.text |VARCHAR |KEYWORD
  32. nested_B |STRUCT |NESTED
  33. nested_B.text |VARCHAR |KEYWORD
  34. ----------------------------------------------------
  35. `nested_A` and `nested_B` cannot be used at the same time, nor `nested_A`/`nested_B` and `nested_A.nested_X` combination.
  36. For such situations, {es-sql} will display an error message.
  37. [float]
  38. === Paginating nested inner hits
  39. When SELECTing a nested field, pagination will not work as expected, {es-sql} will return __at least__ the page size records.
  40. This is because of the way nested queries work in {es}: the root nested field will be returned and it's matching inner nested fields as well,
  41. pagination taking place on the **root nested document and not on its inner hits**.
  42. [float]
  43. === Normalized `keyword` fields
  44. `keyword` fields in {es} can be normalized by defining a `normalizer`. Such fields are not supported in {es-sql}.
  45. [float]
  46. === Array type of fields
  47. Array fields are not supported due to the "invisible" way in which {es} handles an array of values: the mapping doesn't indicate whether
  48. a field is an array (has multiple values) or not, so without reading all the data, {es-sql} cannot know whether a field is a single or multi value.
  49. [float]
  50. === Sorting by aggregation
  51. When doing aggregations (`GROUP BY`) {es-sql} relies on {es}'s `composite` aggregation for its support for paginating results.
  52. But this type of aggregation does come with a limitation: sorting can only be applied on the key used for the aggregation's buckets. This
  53. means that queries like `SELECT * FROM test GROUP BY age ORDER BY COUNT(*)` are not possible.