Documentation Center

Sample query: querying a metadata field of a topic

To query metadata fields, use the period "." as a field/subfield separator, rather than the number sign "#" used in the OpenSearch index.

The OpenSearch index stores metadata fields using a number sign, "#". For example, here's a fragment of an OpenSearch index:
"_source": {
  "clientId": "ish_4489824-4452831-16",
  "dynamicDate": {
    "FTESTDATE#logical#value": "2023-01-31T14:44:00+0000",
    "FTESTDATEMV#logical#value": [
    "2023-01-15T15:45:00Z",
    "2023-01-10T15:45:00Z"
  ]
},
"dynamicDouble": {
  "FTESTNUMBER#logical#value": 123.56,
  "FTESTNUMBERMV#logical#value": [
    11.11,
    22.22
  ]
},
"dynamicText": {
  "FTESTSTRING#logical#value": "Single string",
  "FTESTSTRINGMV#logical#value": [
    "First string",
    "Second string"
  ]
},
However, you should replace the number sign "#" with a period "." when querying these fields through GraphQL. For example, here's a sample query showing a metadata field being queried:
{
  search(criteria: {metadataField: {keys: ["FTESTSTRING.logical.value"], value: "Example"} }) {
    
    results {
      hits
      edges {
        node {
          broker {
            title
          }
          search {
            fields
            id
            rawContent
            mainContentField
          }
        }
      }
    }
  }
}