filter metaobjects by field

Topic summary

Issue: How to filter metaobjects by a specific field value (e.g., color=“blue”) using GraphQL.

Solution Provided:

  • Use the query parameter with the syntax "display_name:blue" in the metaobjects query
  • Example query structure:
metaobjects(type:"xxxxx", first:10, query:"display_name:blue")
  • Important requirement: Must enable the “Use this field as display name” checkbox in the metaobject definition settings (screenshot provided)

Limitations Identified:

  • Filtering only works with the field designated as “display_name”
  • No alternative method exists for filtering by other fields
  • The first or last parameter is mandatory; cannot retrieve all metaobjects without pagination

Status: Resolved with workaround, though user notes the display_name requirement is inconvenient.

Summarized with AI on November 7. AI used: claude-sonnet-4-5-20250929.

If I have a defined Metaobject definition with a field named “color”, how would I fetch only these metaobjects that only have a color of “blue”? The docs so far only refer to “first” / “last” options and “after/before”. Thanks!

Hi ,there

You could refer to below

query FilterMetaobjects {
  metaobjects(type:"xxxxx",first:10,query:"display_name:blue") {
    nodes {
      id
      type
      handle
      displayName
      fields {
        key
        value
      }
    }
  }
}

Also you need to enable the checkbox “Use this field as display_name”

Hi! I’ll give that a try! How can I find that checkbox you are referring to?

Hi, is there no other way to do this if it is not the display name?

And is there any way to leave out first or last? I would want all metaobjects of that type. Thanks!

Currently, I believe that either the first or last field is mandatory, and you are required to paginate all of the metaobjects.

Ah, darn. That’s inconvenient. Thank you!!