I am trying to do a search on a specific field in ...
# getting-started
n
I am trying to do a search on a specific field in the GraphQL API for Datasets… When i try to search for fields like
name
,
origin
,
platform
it works but other than it throws exception…. For example: The below one works but not with fields like
description
or
nativeDataType
Copy code
{
  search(input: {type: DATASET, query: "*", filters: {field: "origin", value: "TEST" }}) {
    start
    count
    total
    entities {
      ... on Dataset {
        urn
        name
        description
        ownership {
          owners {
            owner {
              urn
            }
          }
        }
      }
    }
    facets {
      field
      aggregations {
        value
        count
      }
    }
  }
}
What is needed for this to work?
Exception when trying to search with description…
Copy code
{
  "errors": [
    {
      "message": "Exception while fetching data (/search) : java.lang.RuntimeException: Failed to execute search: entity type DATASET, query *, filters: [com.linkedin.datahub.graphql.generated.FacetFilterInput@6bcd16d7], start: 0, count: 10",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "search"
      ],
      "extensions": {
        "classification": "DataFetchingException"
      }
    }
  ],
  "data": {
    "search": null
  }
}
e
Hey! Are you trying to search by description or add a certain filter?
but this is mainly for filtering the search page. if you want to allow users to query by description (i.e. match terms in the query to dataset description), you need to change the query template
n
This makes sense! Thanks a lot…let me play a little bit with it.
and description for instance is already being indexed https://github.com/linkedin/datahub/blob/master/gms/impl/src/main/resources/index/dataset/mappings.json#L27 so first thing you can try is to just add it into the template and see if it works!