-
Notifications
You must be signed in to change notification settings - Fork 0
Query Syntax
Bright uses Bleve's query string syntax, which provides powerful search capabilities.
Search for a single term across all fields:
hello
Search for an exact phrase:
"hello world"
Search in a specific field:
title:hello
author:"John Doe"
Both terms must be present:
hello AND world
At least one term must be present:
hello OR world
Exclude documents containing the term:
hello NOT world
Use parentheses for complex queries:
(hello OR hi) AND world
title:(quick OR fast) AND status:published
Match any single character:
te?t
# matches: test, text, tent
Match zero or more characters:
test*
# matches: test, testing, tester
*ing
# matches: testing, running, walking
te*t
# matches: test, text, tenant
Find similar terms with edit distance:
hello~1
# matches: hello, hallo, hellow (1 edit away)
hello~2
# matches: hello, hallo, helo, hell (up to 2 edits)
price:>100
price:>=100
price:<50
price:<=50
price:[10 TO 100]
created:[2024-01-01 TO 2024-12-31]
updated:>2024-06-01
name:[a TO m]
Increase the relevance of certain terms:
title:laptop^2 description:laptop
# title matches are twice as important
Use regular expressions (prefix with /):
/joh?n(ath[oa]n)/
To search for special characters, escape them with \:
hello\:world
# searches for literal "hello:world"
Special characters that need escaping:
+ - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /
-
Default Operator: If no operator is specified, OR is used
-
hello world=hello OR world
-
-
Field Search: Prefix the term with field name
-
title:hellosearches only in the title field
-
-
Fuzzy Matching: Use
~for typo tolerance- Good for user-generated search queries
-
Wildcards: Use sparingly as they can be slow
- Avoid leading wildcards (
*term) when possible
- Avoid leading wildcards (
-
Phrase Search: Use quotes for exact matches
-
"exact phrase"vs individual words
-
For complete documentation, see Bleve Query String Query Documentation.