Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4233

Elasticsearch Dismax API is not supported in calcite

    XMLWordPrintableJSON

    Details

      Description

      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 -

      GET /_search
      {
        "query": {
          "dis_max": {
            "queries": [
              {
                "bool": {
                  "should": [
                    {
                      "term": {
                        "Name": "James"
                      }
                    },
                    {
                      "term": {
                        "Name": "Peter"
                      }
                    },
                    {
                      "term": {
                        "Name": "Harry"
                      }
                    },
                    
                  }
                ]
              }
            ]
          }
        }

      Suggested solution  - Queries with OR conditions should use disMax builders to fetch the best matching documents.
       

      Sample SQL query - 

      WHERE Name="James" OR Name="Peter" OR Name="Harry" 

      Sample RelNode - 

      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")

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                shlok7296 Shlok Srivastava
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m