Search metaobjects with search query syntax

Good day!

I’m learning how to work with metaobjects with Admin GraphQL API. At a first glance it looked as if I can search my metaobjects with “query” argument by any of my metaobject fields: https://shopify.dev/docs/api/admin-graphql/2024-04/queries/metaobjects

However, as I understand, only three built-in fields are supported for such queries: id, updated_at and display_name. Any other field I put in a query - I get “Invalid search field for this query” warning debug message.

Is that really so, or am I missing something? My Shopify plan gives me a limit of 128000 metaobjects to store. So how am I suppose to search my metaobjects by custom field value? Retrieving all of them and filtering on the client side doesn’t feel right at all.

Hi,there

I think you could filter your metaobjects based on type, then you need to do your own filter with the results.

query GetMetaobjects {
  metaobjects(type: "xxx", first: 50) {
    nodes {
      id
      displayName
      updatedAt
      fields {
        key
        value
      }
    }
  }
}

Hi Den,

Since the 128,000 limit is for the entire store across all metaobject types, specifying the type (a required field) in the query will limit the results to only the metaobjects of that specific type, which should hopefully help when filtering by display name or updated at.