Skip to main content
Version: 2025-02-27

Searching the VKG: metadataFilter

When searching the VKG, there is an option to provide metadataFilters that will allow you to narrow down search results to nodes with desired metadata. The supported filters are:

  • oneOf
  • moreThan
  • moreThanEq
  • lessThan
  • lessThanEq

These should be specified the same way default and type are specified, inside a wrapped metadataFilter JSON:

{
"metadataFilter": {
"artist": {
"oneOf": ["billie eilish", "metallica", "the weeknd", "michael jackson"]
},
"year": {
"moreThanEq": "2005"
}
}
}

All the filters are key-value pairs with the exception of oneOf which takes in a list of values. Nodes pass when they contain "one of" the list of values in their metadata.

Note that comparisons with numbers that are typed to string or any may not be what you expect for the comparison filters moreThan, moreThanEq, lessThan, and lessThanEq:

  • 2 > 10 is True, because 2 appears ahead of 10 alphanumerically.
  • a > 1 is True, because a appears ahead of 1 alphanumerically.

Due to the ISO standard, datetimes will compare normally. However, as best practice, avoid using the any type and doing comparisions on strings or anys.