Elements Manual
Elements 2 Manual
Elements 2 Manual
  • Welcome 👋
  • QUICK START
    • Elements in Five Minutes or Less
  • General
    • General Concepts
    • N-Tier Architecture
    • Security Model
  • SCRIPTING ENGINE
    • Scripting Engine Overview
      • Intro to Resources and Cloud Functions
      • Horizontal Scaling Model
      • Database Access
      • Server-to-Server API Calls
      • Deploy Cloud Functions via Git
      • Creating and Destroying Resources
      • Cross-Resource Invocation
      • Indexing Resources
      • Coroutines
      • Manifest
  • Core Features
    • Core API Overview
    • Sessions
    • Applications
      • Facebook Application Configuration
      • Firebase Application Configuration
      • Amazon GameOn Application Configuration
      • iOS Application Configuration
      • Android Application Configuration
      • Matchmaking Application Configuration [deprecated]
    • Users and Profiles
    • Digital Goods
    • Progress and Missions
    • Leaderboards
    • Matchmaking
    • Followers
    • Friends
    • Reward Issuance
    • Push Notifications
    • Auth Schemes
    • Save Data
    • Schemas and Metadata Specifications
    • Queries
      • Base Query Syntax
      • Boolean Queries
      • Object Graph Navigation
      • Advanced Operators
        • .ref
        • .name
  • Web 3
    • Omni Chain Support
    • Vaults
    • Wallets
    • Smart Contracts
      • Smart Contracts: Ethereum
      • Smart Contracts: Flow
      • Smart Contracts: Solana
      • Smart Contracts: Neo
    • Know Your Customer
      • Formidium
  • CONFIGURATION
    • Using the Web Console
    • iOS and Android Product Bundles
    • Direct Database Access and Batch Configuration
  • UNITY PLUG-INS
    • Unity Plugin
    • Content Delivery Management and Unity CDN Plugin
  • DEPLOYMENT
    • Deployment Overview
      • Docker Containers
      • AWS Deployment
      • Standalone docker-compose
  • LUA SAMPLES
    • lua Samples
      • main.lua
      • event.lua
      • hello_world.lua
      • model.lua
      • startup.lua
      • HTTP Manifest
        • Example endpoint handler
        • Example operations table
  • RESTful APIs
    • Swagger and Swagger UI
    • Elements 3.0.X (Preview)
      • Applications
      • Friends and Followers
      • Digital Goods and Inventory
      • Leaderboards
      • Missions and Rewards
      • User and Profiles
      • Save Data
      • Custom Metadata
Powered by GitBook
On this page
  • Example: Finding Legendary Swords
  • Example: Finding Legendary Low-Level Swords
  1. Core Features
  2. Queries

Boolean Queries

Combining Base Queries to Form Complex Queries

In addition to Base Query Syntax, it is possible to mix and match multiple queries to perform complex lookups of objects in the database. The following operators allow for greater complexity of finding objects within Elements:

  • AND - Logical all-inclusive operation. Both sides of the AND operation must be true for the object to match.

  • OR - Logical operation which will match if the object matches either the left or right side of the operator

  • NOT - Logical negation. The operator following NOT must be false to match the object in the query.

  • ( ) - Grouping Operator. Groups operations such that they are evaluated before the groups on the outside. Used to force order of operations or provide clarity where the syntax may be ambiguous.

Example: Finding Legendary Swords

With complex Boolean queries, it is possible to perform advanced grouping of data. For example, it may be possible to search for all distinct items with certain metadata fields.

In this case, we can query the whole database for legendary swords:

metadata.type:Sword AND metadata.rarity:Legendary

This will match all objects which match the following criteria:

  • Have a metadata string property named "Type"

  • Have a metadata string property named "Rarity"

  • Type equals the word "Sword"

  • Rarity equals the word, "Legendary"

Example: Finding Legendary Low-Level Swords

We can further refine the query to include stats on the item itself:

metadata.type:Sword AND metadata.rarity:Legendary AND metadata.level:10 TO 20

This will match all objects which match the following criteria:

  • Have a metadata string property named "Type"

  • Have a metadata string property named "Rarity"

  • Type equals the word "Sword"

  • Rarity equals the word, "Legendary"

  • The object's level is between Level 10 and Level 20.

PreviousBase Query SyntaxNextObject Graph Navigation

Last updated 1 year ago