• Couchbase
  • Couchbase Documentation Couchbase Documentation
  • Server
  • Mobile
  • SDKs
Downloads Start Free Trial
Navigation
Server
  • Couchbase Server
    • Introduction
      • Why Couchbase?
      • What’s New?
      • Developer Preview Mode
    • Get Started
      • Start Here!
      • Do a Quick Install
      • Explore the Server Configuration
      • Run Your First N1QL Query
      • Choose Your Next Steps
    • Develop
      • Developer’s Intro
      • Developer Tutorial
        • Install or provision the Couchbase server
        • Buckets, Scopes and Collections
        • Installing the Couchbase Java SDK
        • Creating the Students Collection
        • Creating the Courses Collection
        • Retrieving documents
        • Adding Course Enrollments
      • Developer Guides
        • Connecting to Couchbase
        • Key-Value Operations
          • Creating Data
          • Reading Data
          • Updating Data
          • Deleting Data
          • Bulk Operations
        • Selection Queries
          • Selecting Data
          • Querying Across Relationships
          • Nesting and Unnesting Documents
          • Grouping and Aggregation
        • Indexes
          • Creating Indexes
          • Index Placement
          • Deferring Indexes
          • Selecting Indexes
          • Dropping Indexes
        • Data Manipulation Queries
          • Inserting Data with N1QL
          • Modifying Data with N1QL
          • Deleting Data with N1QL
        • Optimizing Performance
          • Prepared Statements
          • Index Advisor
          • Cost-Based Optimizer
        • Couchbase Transactions
        • Importing Data
        • User-defined Functions with JavaScript
          • Creating a JavaScript Library
          • Creating a User-Defined Function
          • Calling a User-Defined Function
      • SDKs
        • Distributed ACID Transactions
        • Field Level Encryption
        • Response Time Observability
        • Spring Data Couchbase
        • Starter Kits
      • Query
        • Running Queries
          • N1QL Queries and Results
          • Getting System Information
          • N1QL Error Codes
        • Tutorials
        • Query Tools
          • cbq: The Command Line Shell for N1QL
          • Query Workbench
          • Query Monitoring
          • User-Defined Functions
          • N1QL Auditing
          • Backfill Support for N1QL
        • Settings and Parameters
        • Using Indexes
          • Index Lifecycle
          • Indexing and Query Performance
          • Covering Indexes
          • Index Scans
          • Index Pushdowns
          • Grouping and Aggregate Pushdown
          • Early Filters, Order and Pagination
          • Index Availability
          • Storage Settings
        • Advanced Features
          • Flex Indexes
          • Cost-Based Optimizer
          • N1QL Support for Couchbase Transactions
        • N1QL Language Reference
          • Conventions
          • Reserved Words
          • Data Types
          • Literals
          • Identifiers
          • Operators
            • Arithmetic Operators
            • Collection Operators
            • Comparison Operators
            • Conditional Operators
            • Construction Operators
            • Logical Operators
            • Nested Operators and Expressions
            • String Operators
          • Functions
            • Aggregate Functions
            • Array Functions
            • Bitwise Functions
            • Comparison Functions
            • Conditional Functions for Unknowns
            • Conditional Functions for Numbers
            • Date Functions
            • JSON Functions
            • Miscellaneous Utility Functions
              • ADVISOR Function
              • CURL Function
            • Number Functions
            • Object Functions
            • Pattern-Matching Functions
            • Search Functions
            • String Functions
            • Token Functions
            • Type Functions
            • User-Defined Functions
            • Window Functions
          • Subqueries
            • Correlated Subqueries
            • Examples
          • Hints
            • Query Block Hints
            • Keyspace Hints
          • Boolean Logic
          • Statements
            • ADVISE
            • ALTER INDEX
            • BEGIN TRANSACTION
            • BUILD INDEX
            • COMMIT TRANSACTION
            • CREATE COLLECTION
            • CREATE FUNCTION
            • CREATE INDEX
              • Array Indexing
              • Adaptive Index
              • Indexing Metadata Information
              • Index Partitioning
            • CREATE PRIMARY INDEX
            • CREATE SCOPE
            • DELETE
            • DROP COLLECTION
            • DROP FUNCTION
            • DROP INDEX
            • DROP PRIMARY INDEX
            • DROP SCOPE
            • EXECUTE
            • EXECUTE FUNCTION
            • EXPLAIN
            • GRANT
            • INFER
            • INSERT
            • MERGE
            • PREPARE
            • REVOKE
            • ROLLBACK TRANSACTION
            • SAVEPOINT
            • SELECT
              • SELECT Syntax
              • SELECT Clause
              • WITH Clause
              • FROM Clause
              • USE Clause
              • JOIN Clause
              • NEST Clause
              • UNNEST Clause
              • Comma-Separated Joins
              • LET Clause
              • WHERE Clause
              • GROUP BY Clause
              • WINDOW Clause
              • UNION, INTERSECT, and EXCEPT
              • ORDER BY Clause
              • LIMIT Clause
              • OFFSET Clause
            • SET TRANSACTION
            • UPDATE
            • UPDATE STATISTICS
              • Update Statistics for Index Expressions
              • Update Statistics for a Single Index
              • Update Statistics for Multiple Indexes
              • Delete Statistics
            • UPSERT
        • JavaScript Functions with Couchbase
          • Calling JavaScript from N1QL User-Defined Functions
          • Calling N1QL from JavaScript
          • Handling Errors in Javascript Functions
      • Search
        • Quickstart Guide
        • Create Search Indexes
          • Quick Editor and Example
          • Classic Editor and Examples
            • Collections
              • One Field Index
              • Geopoint Index
              • Dynamic Index
            • Bucket Compatibility
              • Legacy Index
          • REST API and Examples
            • Collections
              • One Field Index
              • Geopoint Index
              • Dynamic Index
              • GeoJSON Index
            • Bucket Compatibility
              • Legacy Index
          • Comparing Editors and REST
          • Configure Index Options
            • Type Indentifiers
            • Type Mappings
            • Index Analyzers
            • Custom Filters
            • Date Time Parsers
            • Default Settings
            • Index Replicas
            • Index Type
            • Index Partitioning
        • Create Index Alias
        • Perform Searches
          • Searching from the UI
          • Searching using REST API
            • Request Structure
            • Queries with Curl/HTTP Requests
          • Searching Full Text Indexes/Aliases
          • Searching Multi Collection Indexes
          • Searching using SDK
          • Searching Securely Using SSL
          • Searching from N1QL
        • Search Request
        • Search Response
        • Manage Index Lifecycle
        • High Availability for Search
        • Supported Queries
          • Query String Query
            • Query String Syntax
              • Boosting
              • Date Range
              • Escaping
              • Field Scoping
              • Match Phrase
              • Match Query Syntax
              • Numeric Range
          • Match
          • Match Phrase
          • Non Analytic Queries
            • Term
            • Phrase
            • Prefix
            • Regexp
            • Fuzzy
            • Wilcard
          • Compound Queries
            • Conjuncts and Disjuncts
            • Boolean
          • Range Queries
            • Numeric Range
            • Date Range
            • Term Range
          • Geo Spatial Queries
            • Geopoint Queries
              • Geopoint Distance
              • Geopoint Bounded Rectangle
              • Geopoint Bounded Polygon
            • GeoJSON Queries
              • Point Query
              • LineString Query
              • Polygon Query
              • MultiPoint Query
              • MultiLineString Query
              • MultiPolygon Query
              • GeometryCollection Query
              • Circle Query
              • Envelope Query
          • Special Queries
            • Match All
            • Match None
        • Search Service Architecture
          • Scatter Gather
          • Ports Used By FTS
          • Rebalance/Failover
        • Cluster Level Options
          • bleveMaxResultWindow
          • bleveMaxClauseCount
          • maxFeedsPerDCPAgent
          • maxConcurrentPartitionMovesPerNode
          • enableVerboseLogging
          • ftsMemoryQuota
          • maxReplicasAllowed
          • slowQueryLogTimeout
          • CBFT_ENV_OPTIONS
        • Statistics and Monitoring
        • Troubleshooting and FAQs
      • Eventing
        • Terminology
        • Language Constructs
          • Advanced Keyspace Accessors
          • Timers
          • cURL
        • Eventing Lifecycle
        • Buckets vs Collections
        • Eventing Role-Based Access Control
        • Examples: Using the Eventing Service
          • Data Enrichment
          • Cascade Delete
          • Document Expiry
          • Delete v Expiry
          • Document Archival
          • Cancel or Overwrite Timer
          • Recurring Timer
          • External REST via cURL GET
          • Risk Assessment
        • Examples: Terse Scriptlets
          • Basic KV Functions
            • basicBucketOps
            • basicCurlGet
            • basicCurlPost
            • simpleTimer
            • cascadeKvDeleteWithDoc
            • redactSharedData
            • simpleFlatten
            • fixEmailDomains
            • keepLastN
            • docControlledSelfExpiry
            • shippingNotifier
            • ConvertBucketToCollections
          • Basic N1QL Functions
            • basicN1qlSelectStmt
            • basicN1qlPreparedSelectStmt
          • Generic Manipulation Functions
            • dateToEpochConversion
            • deepCloneAndModify
            • removeObjectStubs
            • removeNullsAndEmptys
            • genericRename
            • genericFlatten
            • convertXMLtoJSON
            • convertAdvXMLtoJSON
          • Advanced Accessor Functions
            • advancedGetOp
            • advancedGetOpWithCache
            • advancedInsertOp
            • advancedUpsertOp
            • advancedReplaceOp
            • advancedDeleteOp
            • advancedIncrementOp
            • advancedDecrementOp
            • advancedKeepLastN
            • advanced-DocControlledSelfExpiry
            • multiCollectionEventing
          • Binary Document Support
            • basicBinaryKV
            • advancedBinaryKV
          • Performance Functions
            • fasterToLocalString
        • Debugging and Diagnosability
        • Statistics
        • Troubleshooting and Best Practices
        • Frequently Asked Questions
    • Learn
      • Overview
        • Glossary
        • List of Architecture Diagrams
      • Data
        • Data Model
        • N1QL versus SQL
        • Extended Attributes
        • Scopes and Collections
        • Indexes
        • Durability
        • Expiration
        • Transactions
      • Buckets, Memory, and Storage
        • Buckets
          • vBuckets
          • Compression
        • Memory and Storage
          • Memory
          • Storage Engines
          • Storage Settings
      • Services
        • Data Service
        • Query Service
        • Index Service
        • Search Service
        • Analytics Service
        • Eventing Service
        • Backup Service
      • Clusters and Availability
        • Cluster Manager
        • Metadata Management
        • Connectivity
        • System Events
        • Size Limits
        • Nodes
          • Rebalance
          • Removal
          • Failover
            • Graceful
            • Hard
            • Automatic
          • Recovery
          • Node-to-Node Encryption
        • Availability
          • Intra-Cluster Replication
          • Cross Data Center Replication (XDCR)
            • XDCR Advanced Filtering
            • XDCR Conflict Resolution
            • XDCR with Scopes and Collections
          • Server Group Awareness
      • Security
        • Authentication
          • Understanding Authentication
          • Usernames and Passwords
          • Authentication Domains
          • Certificates
            • Using Multiple Root Certificates
        • Authorization
          • Roles
          • Upgrading to RBAC
        • On-the-Wire Security
        • Auditing
        • Encryption
    • Manage
      • Overview
        • Couchbase Web Console
      • Manage Nodes and Clusters
        • Initialize a Node
        • Create a Cluster
        • Add a Node and Rebalance
        • Join a Cluster and Rebalance
        • List Cluster Nodes
        • Remove a Node and Rebalance
        • Fail a Node Over and Rebalance
          • Graceful
          • Hard
        • Recover a Node and Rebalance
        • Manage Node-to-Node Encryption
        • Manage Address Families
      • Manage Buckets
        • Create a Bucket
        • Edit a Bucket
        • Flush a Bucket
        • Drop a Bucket
      • Manage Scopes and Collections
      • Manage Logging
      • Manage Settings
        • General
        • Auto-Compaction
        • Alerts
        • Sample Buckets
      • Manage Server Groups
      • Manage XDCR
        • Prepare for XDCR
        • Create a Reference
        • Create a Replication
        • Pause a Replication
        • Resume a Replication
        • Delete a Replication
        • Delete a Reference
        • Secure a Replication
          • Half-Secure
          • Fully Secure
        • Replicate Using Scopes and Collections
        • Filter a Replication
        • Recover Data with XDCR
      • Manage Security
        • Manage Security Settings
        • Manage Users, Groups, and Roles
        • Manage Authentication
          • Configure LDAP
          • Configure saslauthd
          • Configure PAM
          • Manage Certificates
            • Configure Server Certificates
            • Configure Client Certificates
            • Enable Client-Certificate Handling
            • Certificate Rotation
            • Certificate Error Handling
        • Manage On-the-Wire Security
        • Manage Auditing
        • Manage Sessions
        • Manage Console Access
        • Manage System Secrets
        • Manage Connections and Disks
      • Manage Statistics
      • Manage Indexes
      • Import Documents
      • Manage Backup and Restore
        • cbbackupmgr
          • Strategies
          • Tutorial
          • Cloud Backup
          • Network Filesystems
          • Encryption
      • Monitor
        • Monitor Queries
        • Monitor Indexes
        • Monitor Clock Drift
        • Set up Prometheus for Monitoring
      • Troubleshoot
        • Common Errors
        • Core Files
    • Install & Upgrade
      • Deployment Options
      • System Requirements
        • Supported Operating Systems
        • System Resource Requirements
        • Additional Requirements
        • Couchbase Server Ports
      • Deployment Guidelines
        • Sizing Guidelines
        • Clock Synchronization Requirements
        • Disable THP
        • Configure Kernel Swappiness
        • Security Considerations
        • Couchbase Server Process List
        • VM and Container Guidelines
        • About Clusters with Fewer Than 3 Nodes
      • Installation
        • Install on Linux
          • Red Hat & CentOS
          • Ubuntu & Debian
          • SUSE Enterprise
          • Oracle Enterprise
          • Amazon Linux 2
          • Non-Root Install and Upgrade
          • Install Multiple Instances
        • Install on Windows
        • Install on macOS
        • Verify the Installation
        • Startup and Shutdown
        • Uninstall
      • Cloud and Container Deployment
        • AWS
          • Deploy with AWS Marketplace
          • Deploy Sync Gateway with AWS Marketplace
          • Deploy with Terraform
        • Azure
          • Deploy with Azure Marketplace
        • GCP
          • Deploy with GCP Marketplace
        • Kubernetes & OpenShift
          • Deploy with Autonomous Operator
        • Docker
          • Install with Docker
        • Couchbase Containers FAQ
      • Upgrade
        • Upgrade-Procedure Selection
        • Upgrade Procedures
          • Cluster Offline
          • Cluster Online
            • At Reduced Capacity
            • At Full Capacity
            • Upgrade an Online Docker Cluster, Full Capacity
          • IPv6 Cluster-Upgrade
        • Feature Availability During Upgrade
      • Migration
        • Migrating Data
        • Enabling Timestamp-based Conflict Resolution for Migrated Data
    • Integrate
      • Connector Guides
      • Elasticsearch Plug-in
      • Kafka Connector
      • Spark Connector
      • Tableau Connector
      • Couchbase ODBC and JDBC Drivers
    • Reference
      • CLI Reference
        • cbanalyze-core
        • cbbackup
        • cbbackupwrapper
        • cbcollect_info
        • cbepctl
          • set checkpoint_param
          • set flush_param
          • set tap_param
        • cbft-bleve
          • cbft-bleve: Moss Indexes
          • cbft-bleve: Scorch Indexes
          • cbft-bleve: Zap Files
        • cblogredaction
        • cbq
        • cbrecovery
        • cbrestore
        • cbrestorewrapper
        • cbstats
          • all
          • allocator
          • checkpoint
          • collections
          • collections-details
          • config
          • dcp
          • dcpagg
          • dcp-vbtakeover
          • diskinfo
          • dispatcher
          • durability-monitor
          • failovers
          • hash
          • items
          • key
          • kvstore
          • kvtimings
          • memory
          • prev-vbucket
          • raw
          • reset
          • responses
          • runtimes
          • scheduler
          • scopes
          • scopes-details
          • slabs
          • tap-vbtakeover
          • tasks
          • timings
          • uuid
          • vbucket
          • vbucket-details
          • vbucket-seqno
          • vkey
          • warmup
          • workload
        • cbsummary
        • cbtransfer
        • cbworkloadgen
        • couchbase-server
        • mctimings
      • REST API Reference
        • Nodes and Clusters API
          • Cluster Initialization and Provisioning
            • Initializing a Cluster
            • Initializing a Node
            • Establishing Credentials
            • Naming a Node
            • Configuring Memory
            • Assigning Services
            • Naming a Cluster
          • Node Addition and Removal
            • Adding Nodes to Clusters
            • Joining Nodes into Clusters
            • Removing Nodes from Clusters
          • Rebalance
            • Rebalancing the Cluster
            • Getting Rebalance Progress
            • Configuring Rebalance Retries
            • Getting Rebalance-Retry Status
            • Canceling Rebalance Retries
            • Limiting Concurrent vBucket Moves
            • Disabling Consistent View Query Results on Rebalance
          • Manual Failover
            • Performing Hard Failover
            • Performing Graceful Failover
            • Setting Recovery Type
          • Auto-Failover
            • Retrieving Auto-Failover Settings
            • Enabling and Disabling Auto-Failover
            • Resetting Auto-Failover
            • Setting Recovery Type
          • Settings and Connections
            • Managing Internal Settings
            • Managing Cluster Connections
            • Managing Alternate Addresses
            • Setting Alerts
          • Status and Events
            • Getting Cluster Tasks
            • Retrieving Cluster Information
            • Viewing Cluster Details
            • Getting System Events
            • Identifying the Orchestrator Node
            • Getting Information on Nodes
            • Listing Node Services
          • Statistics
            • Getting a Single Statistic
            • Getting Multiple Statistics
          • Logging API
            • Retrieving Log Information
            • Creating Client Logs
        • Buckets API
          • Creating and Editing Buckets
          • Getting Bucket Information
          • Listing Nodes by Bucket
          • Getting Bucket Statistics
          • Getting Bucket Streaming URI
          • Deleting Buckets
          • Flushing Buckets
          • Managing Sample Buckets
        • Scopes and Collections API
          • Creating a Scope
          • Creating a Collection
          • Listing Scopes and Collections
          • Dropping a Collection
          • Dropping a Scope
        • Memory and Storage API
          • Initializing a Node
          • Configuring Memory
          • Setting Thread Allocations
          • Getting Storage Information
          • Performing Compaction Manually
          • Auto-Compaction: Global
          • Auto-Compaction: Per Bucket
        • Server Groups API
          • Getting Group Information
          • Creating Groups
          • Adding Nodes to Groups
          • Renaming Groups
          • Updating Group Membership
          • Deleting Groups
        • XDCR API
          • Creating and Editing References
          • Getting a Reference
          • Creating a Replication
          • Pausing and Resuming a Replication
          • Deleting a Replication
          • Deleting a Reference
          • Managing Advanced Settings
          • Getting Statistics
        • Security API
          • Who Am I?
          • Configure Auditing
          • Restrict Node-Addition
          • Authentication API
            • Configure LDAP
            • Configure saslauthd
            • Set Password Policy
            • Certificate Management API
              • Load Root Certificates
              • Get Root Certificates
              • Delete Root Certificates
              • Retrieve All Node Certificates
              • Upload and Retrieve a Node Certificate
              • Regenerate All Certificates
              • Deprecated Certificate Management APIs
                • Upload and Retrieve the Root Certificate
          • Authorization API
            • Role-Based Access Control (RBAC)
          • Configure On-the-Wire Security
          • Configure HSTS
          • Secret Management API
        • Query Service API
          • Examples
            • Successful request
            • Request with positional parameters
            • Request with Named Parameters
            • Request Timeout
            • Request error
            • Service error
            • N1QL error
            • Unsupported HTTP method
            • Request with authentication - HTTP header
            • Request with authentication - request parameter
          • Admin REST API
          • Query Settings API
          • Functions REST API
        • Index Service API
          • Retrieve GSI Settings
          • Set GSI Settings
          • Index Statistics API
          • Modify Index Batch Size
        • Backup Service API
          • Create and Edit Plans
          • Create a Repository
          • Get Information on Repositories
          • Get Information on Plans
          • Get Information on Tasks
          • Pause and Resume Tasks
          • Examine Backed-Up Data
          • Perform an Immediate Backup
          • Perform an Immediate Merge
          • Restore Data
          • Delete a Backup
          • Archive a Repository
          • Import a Repository
          • Delete a Repository
          • Delete a Plan
          • Get Information on the Cluster
          • Manage Backup Configuration
        • Search Service API
          • Node Configuration
          • Indexes
          • Advanced
          • Search Statistics
          • Active Queries
          • Rebalance Based on File Transfer
        • Eventing Service API
        • Analytics Service API
          • Analytics Service REST API
          • Analytics Admin REST API
          • Analytics Config REST API
          • Analytics Settings REST API
          • Analytics Links REST API
          • Analytics Library REST API
      • XDCR Reference
        • Advanced Settings
        • Filtering
          • Regular Expressions
          • Filtering Expressions
          • Data-Type Conversion
        • Security and Networking
      • Audit Event Reference
      • System Event Reference
      • Rebalance Reference
      • Metrics Reference
        • Data Service Metrics
        • Query Service Metrics
        • Index Service Metrics
        • Search Service Metrics
        • Eventing Service Metrics
        • Analytics Service Metrics
        • Backup Service Metrics
        • Cluster Manager Metrics
        • XDCR Metrics
        • Metrics for All Services
      • Views Reference
        • View Concepts
          • Stream-based Views
          • View Operations
          • Views and Stored Data
          • Development Views
          • Production Views
        • MapReduce Views
          • Writing MapReduce Views
            • Views Best Practices
            • Map Function
            • Reduce Function
            • Built-in Utility Functions
            • Built-in _count Function
            • Built-in _sum Function
            • Built-in _stats Function
            • Re-writing Built-in Reduce Functions
            • Custom Reduce Functions
            • Re-reduce Argument
            • Views for Non-JSON Objects
            • Translating SQL to MapReduce
            • Views in a Schema-less Database
          • Querying MapReduce Views
            • View and Query Examples
        • Views API
          • Getting Design Doc Information
          • Creating Design Documents
          • Deleting Design Documents
          • Getting Views Information
          • Limiting Views Requests
    • Release Notes & Licenses
      • Release Notes
      • Licenses for Third-Party Components
    • Contribute
      • Contribute to the Documentation
  • Edit on GitHub

Is this page helpful?

Yes No
Leave Additional Feedback?
Skip

Please use the form below to provide your feedback. Because your feedback is valuable to us, the information you submit in this form is recorded in our issue tracking system (JIRA), which is publicly available. You can track the status of your feedback using the ticket number displayed in the dialog once you submit the form.

  • Couchbase Server
  • Develop
  • Search
  • Supported Queries
  • Query String Query
  • Query String Syntax

Query String Syntax

    +
    Query strings enable you to describe complex queries using a simple syntax.

    Using the query string syntax, the following query types can be performed:

    • Boosting

    • Date Range

    • Escaping

    • Field Scoping

    • Match Phrase

    • Match Query Syntax

    • Numeric Range

    Couchbase
    • Documentation
    • Forums
    • Support
    • Developer Portal
    • Blog
    • Resources
    • Get Started
    • Downloads
    • Training
    • Twitter
    • Linkedin
    • Facebook
    © 2022 Couchbase, Inc. Couchbase, Couchbase Lite and the Couchbase logo are registered trademarks of Couchbase, Inc.
    Terms of Use Privacy Policy Cookie Policy Support Policy Marketing Preference Center