Skip to content

Support for DSL functionalities #160

Closed

Description

@asfoorial

One ideal scenario for OpenSearch is to run a DLS query that filters documents and return the result alongs with related aggregations (facets) and related highlights all in one query. Can we have this exact behaviour in SQL?

The way I can think of it is, I write a main SQL query (which is a search/filter query) then I can add a highlights function that accepts parameters such as fields names and then add an aggregation clause (an aggregation SQL statement). It can look like the below example.

select doc_name, author, location, highlights(('doc_name','author')) as doc_highlights from my-docs where author='hasan' aggregate by (select count(*), location from my-docs group by location)

The result will be two tables as follows:

Tables 1:
doc_name | author | location | highlights |
doc1 | hasan | /folder1 | JSON highlights
.
.

Table 2

count(*) | location
10 | /folder1
2 | /folder2

Note1:
The aggregation only applies on the result of the main query.

Note2:
Highlights can returned in exactly the same JSON format that is produced for a DSL query or any other workable format.

Activity

  1. added
    enhancement
    on Jul 15, 2021
  2. anirudha commented on Aug 19, 2021

    @anirudha
    Collaborator

    @asfoorial pls review #182

  3. acarbonetto commented on Aug 3, 2022

    @acarbonetto
    Collaborator

    The highlight function is being added under #636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementv1.2.0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions