You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Danny Chen (Jira)" <ji...@apache.org> on 2020/11/02 07:37:00 UTC

[jira] [Resolved] (CALCITE-4233) Elasticsearch Dismax API is not supported in calcite

     [ https://issues.apache.org/jira/browse/CALCITE-4233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Danny Chen resolved CALCITE-4233.
---------------------------------
    Fix Version/s: 1.27.0
       Resolution: Fixed

Fixed in [b20e0bf|https://github.com/apache/calcite/commit/b20e0bf6ca9b605fa4a6203bd06454abd6a98ce2], thanks for the PR, [~shlok7296] ~

> Elasticsearch Dismax API is not supported in calcite
> ----------------------------------------------------
>
>                 Key: CALCITE-4233
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4233
>             Project: Calcite
>          Issue Type: Improvement
>          Components: elasticsearch-adapter
>            Reporter: Shlok Srivastava
>            Priority: Major
>              Labels: QueryBuilder, calcite, dismax, elasticsearch
>             Fix For: 1.27.0
>
>
> Currently, Calcite use constant_score API to build all the queries. which do not boost the documents based on relevance score from any matching clause which is supported by disMax API. It does not support dismax query builders - [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-dis-max-query.html.]
>  
> Dismax query -
> {code:java}
> GET /_search
> {
>   "query": {
>     "dis_max": {
>       "queries": [
>         {
>           "bool": {
>             "should": [
>               {
>                 "term": {
>                   "Name": "James"
>                 }
>               },
>               {
>                 "term": {
>                   "Name": "Peter"
>                 }
>               },
>               {
>                 "term": {
>                   "Name": "Harry"
>                 }
>               },
>               
>             }
>           ]
>         }
>       ]
>     }
>   }{code}
> Suggested solution  - Queries with OR conditions should use disMax builders to fetch the best matching documents.
>   
> Sample SQL query - 
> {code:java}
> WHERE Name="James" OR Name="Peter" OR Name="Harry" {code}
> Sample RelNode - 
> {code:java}
> relB.or(relB.equals(relb.literal("Name"),relb.literal"James"),
> relB.equals(relb.literal("Name"),relb.literal"Peter"),
> relB.equals(relb.literal("Name"),relb.literal"Harry"){code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)