LambdaDB supports a simple string query that uses the Lucene Query Syntax to search documents. Specifically, term, phrase, wildcard, boolean operators, range operators, and special character escaping are supported.

Parameters

ParameterDescriptionTypeRequiredDefault
queryQuery stringobject
defaultFieldDefault field name to apply querystring
skipSyntaxSkip syntax check for special charactersbooleanfalse
A query to a collection with object field type requires special handling.

Examples

Basic query

{
  "queryString": {
    "query": "hello world",
    "defaultField": "text"
  }
}
The above example is equivalent to:
{
  "queryString": {
    "query": "text:hello OR text:world",
  }
}
You can also query multiple fields by specifying field names in the query string. Terms are separated by spaces, and specific fields are targeted using the field:value syntax:
{
  "queryString": {
    "query": "hello world keyword:python",
    "defaultField": "text"
  }
}
For handling special characters, use the skipSyntax option:
{
  "queryString": {
    "query": "hello! world?",
    "defaultField": "text",
    "skipSyntax": true
  }
}

Exact match query

{
  "queryString": {
    "query": "keyword",
    "defaultField": "keyword"
  }
}
If the keyword includes special characters, you can use the skipSyntax option:
{
  "queryString": {
    "query": "https://sample_url.com",
    "defaultField": "keyword",
    "skipSyntax": true
  }
}
Alternatively, wrap them in double quotes (”)
{
  "queryString": {
    "query": '"https://sample_url.com"',
    "defaultField": "keyword"
  }
}
To search for keywords that contain spaces, you need to wrap them in double quotes (”). For example, to search for the phrase hello world as a single keyword, use:
{
  "queryString": {
    "query": '"hello world"',
    "defaultField": "keyword"
  }
}

Range query

Range queries allow you to search for values within a specific range using range query syntax.

Supported field types

Range queries work with the following field types:
  • long
  • double
  • datetime
  • keyword

Syntax

  • Inclusive range: [min TO max] includes both lower and upper bounds.
  • Exclusive range: {min TO max} excludes both lower and upper bounds.
{
  "queryString": {
    "query": "[123 TO 456]",
    "defaultField": "long"
  }
}
{
  "queryString": {
    "query": "{2024-03-10T09:15:45Z TO 2024-03-10T09:15:46Z}",
    "defaultField": "datetime"
  }
}