Table of documentation contents

Inspect a Weaviate

Index

Basics

  • You can use the GraphQL __type filters to inspect the structure of a Weaviate.
  • Handy if you want to integrate Weaviate features into a front-end application.

Introduction

If you want to inspect your Weaviate, i.e., understanding its structure and available functionalities, you can use the __type GraphQL query. It allows you to understand how your Weaviate is structured.

Weaviate Structure

Weaviate uses the following GraphQL structure.

{
  {
    Explore (
      network: <Boolean>,
      concepts: [<String>]!,
      limit: <Int>,
      certainty: <Float>,
      moveTo: {
        concepts: [<String>]!,
        force: <Float>!
      },
      moveAwayFrom: {
        concepts: [<String>]!,
        force: <Float>!
      }
    ) {
      beacon
      certainty
      className
    }
  }
  Get {
    <SematicKind> {
      <Class>(
        explore: {
          concepts: [<String>]!
          moveAwayFrom: {
            concepts: [<String>]!
            force: <Float>!
          },
          moveTo: {
            concepts: [<String>]!
            force: <Float>!concept.
          }
        },
        limit: <Int>,
        where: {
          operator: <operator>,
          operands: [{
            path: [path],
            operator: <operator>
            <valueType>: <value>
          }, {
            path: [<matchPath>],
            operator: <operator>,
            <valueType>: <value>
          }]
        }) {
        <property>
        <PropertyWithReference>
          ... on <ClassOfBeacon> {
            <property>
          }
      }
    }
    Aggregate {
      <SematicKind> {
        <Class> {
          groupedBy {
              path
              value
          }
          meta {
            count
          }
          <propertyOfDatatypeString> {
              count
              type
              topOccurrences {
                  value
                  occurs
              }
          }
          <propertyOfDatatypeText> {
              count
              type
              topOccurrences {
                  value
                  occurs
              }
          }
          <propertyOfDatatypeNumberOrInteger> {
              count
              type
              minimum
              maximum
              mean
              median
              mode
              sum
          }
          <propertyOfDatatypeBoolean> {
              count
              type
              totalTrue
              totalFalse
              percentageTrue
              percentageFalse
          }
          <PropertyWithReference>
            pointingTo
            type
        }
      }
    }
  }
}

Get Metadata

Within Weaviate, GraphQL objects are retrievable by their name. At the root, there is the WeaviateObj object. You can retrieve all the metadata with the following query:

{
  __type(name: "WeaviateObj") {
    name
    description
    fields {
      name
      description
      type {
        name
        description
      }
    }
    kind
    possibleTypes {
      name
      description
    }
    ofType {
      name
      description
    }
    inputFields {
      description
      defaultValue
    }
    interfaces {
      name
      description
    }
    enumValues {
      description
      deprecationReason
    }
  }
}

🟒 Click here to try out this graphql example in the Weaviate Playground.

If you want to explore the GraphQL tree further, you can use one of the names (name field) in the type object of the fields array.

For example, to get an overview of the Get{} function you can collect the data like this:

{
  __type(name: "GetObj") { # 'name' of 'type' in the 'fields' array
    name
    description
    fields {
      name
      description
      type {
        name
        description
      }
    }
    kind
    possibleTypes {
      name
      description
    }
    ofType {
      name
      description
    }
    inputFields {
      description
      defaultValue
    }
    interfaces {
      name
      description
    }
    enumValues {
      description
      deprecationReason
    }
  }
}

🟒 Click here to try out this graphql example in the Weaviate Playground.

Weaviate Schema Metadata

To get an overview of the available user-defined Weaviate schema you can use the following queries.

Things

{
  __type(name: "GetThingsObj") {
    name
    description
    fields {
      name
      description
      type {
        name
        description
      }
    }
    kind
    possibleTypes {
      name
      description
    }
    ofType {
      name
      description
    }
    inputFields {
      description
      defaultValue
    }
    interfaces {
      name
      description
    }
    enumValues {
      description
      deprecationReason
    }
  }
}

🟒 Click here to try out this graphql example in the Weaviate Playground.

Actions

{
  __type(name: "GetActionsObj") {
    name
    description
    fields {
      name
      description
      type {
        name
        description
      }
    }
    kind
    possibleTypes {
      name
      description
    }
    ofType {
      name
      description
    }
    inputFields {
      description
      defaultValue
    }
    interfaces {
      name
      description
    }
    enumValues {
      description
      deprecationReason
    }
  }
}

🟒 Click here to try out this graphql example in the Weaviate Playground.

More Resources

If you can’t find the answer to your question here, please use the:

  1. Knowledge base of old issues. Or,
  2. For questions: Stackoverflow. Or,
  3. For issues: Github.
  4. For Frequently Asked Questions.
Tags
  • Contextionary
  • Inspect