[ 
https://issues.apache.org/jira/browse/CALCITE-5049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17509189#comment-17509189
 ] 

Jiajun Xie commented on CALCITE-5049:
-------------------------------------

[~yamaga] Is the filed `ID_ART` text type? Field data is disabled on text 
fields by default in ES.

FYI:https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html#fielddata-mapping-param

> Error when executing join on Elasticsearch Adapter
> --------------------------------------------------
>
>                 Key: CALCITE-5049
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5049
>             Project: Calcite
>          Issue Type: Bug
>          Components: elasticsearch-adapter
>    Affects Versions: 1.29.0
>            Reporter: Yamaga fow
>            Priority: Critical
>
> Hi
> I am trying to make a SQL join query over Elasticsearch but it's returning 
> this error:
>  
> SQL query:
> {code:java}
> SELECT * FROM "jp_art_desc" a inner join "jp_art_coef" b ON a.ID_ART = 
> b.ID_ART ; {code}
> Error:
> {code:java}
> SQL Error: Error while executing SQL "SELECT * FROM "jp_art_desc" a inner  
> join "jp_art_coef" b ON a.ID_ART = b.ID_ART ": 
> org.elasticsearch.client.ResponseException: method [POST], host [http://***], 
> URI [/jp_art_desc/_search?scroll=1m], status line [HTTP/1.1 400 Bad Request]
> {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Text 
> fields are not optimised for operations that require per-document field data 
> like aggregations and sorting, so these operations are disabled by default. 
> Please use a keyword field instead. Alternatively, set fielddata=true on 
> [ID_ART] in order to load field data by uninverting the inverted index. Note 
> that this can use significant 
> memory."}],"type":"search_phase_execution_exception","reason":"all shards 
> failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"jp_art_desc","node":"rcltVuOcTJOLJxnuGelrOA","reason":{"type":"illegal_argument_exception","reason":"Text
>  fields are not optimised for operations that require per-document field data 
> like aggregations and sorting, so these operations are disabled by default. 
> Please use a keyword field instead. Alternatively, set fielddata=true on 
> [ID_ART] in order to load field data by uninverting the inverted index. Note 
> that this can use significant 
> memory."}}],"caused_by":{"type":"illegal_argument_exception","reason":"Text 
> fields are not optimised for operations that require per-document field data 
> like aggregations and sorting, so these operations are disabled by default. 
> Please use a keyword field instead. Alternatively, set fielddata=true on 
> [ID_ART] in order to load field data by uninverting the inverted index. Note 
> that this can use significant 
> memory.","caused_by":{"type":"illegal_argument_exception","reason":"Text 
> fields are not optimised for operations that require per-document field data 
> like aggregations and sorting, so these operations are disabled by default. 
> Please use a keyword field instead. Alternatively, set fielddata=true on 
> [ID_ART] in order to load field data by uninverting the inverted index. Note 
> that this can use significant memory."}}},"status":400} {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to