Documentation Center

GraphQL request querying metadata fields

You can perform a search by querying metadata fields.

If you want to search using metadata fields, specify the metadata field name as a value for keys, the value you search for as value, and the data type of the metadata field as type. For example, the following query find items whose metadata text field country has the value Argentina:
search(
  criteria:{
    metadataField:{
      keys: ["country"],
      value: "Argentina",
      type: TEXT
    }
  }
)

If your metadata field has subfields, add the subfield you want to query to the keys array. For example, if the metadata field address has a houseNumber subfield, set keys to the value ["address","houseNumber"] to query that subfield.

If you omit the type field, it will be given the value ANY, which means that fields of all types are searched to find the one called country. It's also possible that your Schema contains two metadata fields with different data types, both called country. In that scenario, your query would fail unless you specified the type field.