OS1 Services
Data Listing and Query (DLQS) ...

Search Query Format

16min

Overview

This is a comprehensive guide to Elasticsearch's query format, detailing the diverse query types available for precise search operations. The queries covered include match, term, terms, prefix, regexp, range, exists, geo_distance, geo_bounding_box, and geo_polygon. Each query type includes JSON examples and practical explanations for their specific applications.

This guide provides developers with an in-depth understanding of how to effectively leverage Elasticsearch's diverse querying capabilities for their search requirements.

match

This field allows you to search for records that match a certain condition. It is an array that consists of objects with a "key" and a "value".

JSON


term

This field is used to search for records that exactly match a given condition. The condition is specified as an array of objects with a "key" and a "value". The query examples below include a string, a number, and a boolean value

Here are some examples of term queries:

Query 1 (String)
Query 2 (number)
Query 3 (boolean)






terms

This field is used to search for records where the specified key's value is in the list of specified values. It's an array of objects with a "key" and an array of "values". The "values" can be an array of strings, numbers, or booleans.

Here are some examples of terms queries:

Query 1 (string)
Query 2 (number)
Query 3 (boolean)



prefix

This query is used to search for records that begin with the provided value for the given key. The value is case-sensitive.



Query 1
Query 2



regexp

This query is used to search for records that match a regular expression pattern for the given key.



Query



range

This query is used to search for records where the specified key's value falls within the given range.

Here are some examples:

Query 1
Query 2



exists

This query is used to search for records where the specified key is present.

Here are some examples:

Query 1

Query 1
Query 2



geo_distance

This query is used to search for records where the specified key's coordinates fall within a specified radius from a given point.

Here are some examples:

Query 1

Query 1
Query 2



geo_bounding_box

This query is used to search for records where the specified key's coordinates fall within a specified bounding box.

Query



geo_polygon

This query is used to search for records where the specified key's coordinates fall within a specified polygon.

Query