Skip to content

Support common function in SQL/PPL query engine #190

@chloe-zh

Description

@chloe-zh

Related design is presented in issue #182

Todo list

  • Support the common functionality by pushing it down to the search engine
  • Enable common function in SQL and PPL syntax and parser, including all the available parameters
  • Make sure the function in new engine is compatible with the old engine support
  • Add unit tests. (Unit tests are mandatory for all code changes.)
  • Add integration test cases for common
  • Update user manual

Function details

The common function maps to the common terms query used in the search engine. This query is a modern alternative to stopwords which improves the precision and recall of search results (by taking stopwords into account), without sacrificing performance.

Syntax:
common(field_expression, query_expression[, option=<option_value>]*)

Available options:

  • analyzer
  • cutoff_frequency
  • high_frequency_operator
  • low_frequency_operator
  • minimum_should_match
  • boost

Sample query:

# Search query 1
GET my_index/_search
{
  "query": {
    "common": {
      "message": {
        "query": "this is bonsai cool",
        "cutoff_frequency": 0.001
      }
    }
  }
}

# SQL
SELECT * FROM my_index WHERE common(message, "this is bonsai cool", cutoff_frequency=0.001)

# PPL
source=my_index | where common(message, "this is bonsai cool", cutoff_frequency=0.001)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions