Hi all! I am trying to make a new entity type cal...
# troubleshoot
g
Hi all! I am trying to make a new entity type called Notebook searchable in the UI. I am able to render the entity page: i.e.
<http://localhost:9002/notebook/urn:li:notebook:(querybook,123456)/features>
I can see the metadata item on the main page I.e.
<http://localhost:9002>
but the browse fails to load anything I.e.
<http://localhost:9002/browse/notebook>
I suspect there's a wiring that I am missing somewhere that makes the entities discoverable when going through browse. Anyone know where that occurs? Thanks!
g
Hey Kartik, let me see here 🤔
I think I do remember there being something.
Out of curiosity, 1. are there any error messages in react or GMS when you try to load browse? or just no results? 2. did you ingest a BrowsePath aspect for the entities? This would be required to construct the browse path 🙂 3. does search work for notebooks?
g
No errors in the GraphQL call or the gms service
Not sure if search works, let me try that
no results for search
g
ok… did you add any @Searchable annotations to your model?
those would be needed to make your entity searchable
g
Let me check that. I also saw this file where I didn't define the new entity type`/datahub-web-react/src/app/lineage/utils/useGetEntityQuery.ts`
g
ok- that will be needed for the lineage viz to work, but shouldn’t be needed for search or browse.
g
There's some sub aspects that are marked as searchable:
Copy code
record NotebookInfo includes CustomProperties, ExternalReference {

  /**
   * Title of the Notebook
   */
  @Searchable = {
    "fieldType": "TEXT_PARTIAL",
    "enableAutocomplete": true,
    "boostScore": 10.0
  }
  title: string
  
  ... other fields here, skipping to make it more concise


}
g
Hmm- can you double check what your elasticsearch index for the Notebook entity looks like?
does it have documents?
if so, could you share some sample documents?
g
not sure if this helps, but here's the raw data in the notebook index:
Copy code
sh-4.2# curl -X GET "localhost:9200/notebookindex_v2/_search?pretty" -H 'Content-Type: application/json' -d'
{
    "query": {
        "match_all": {}
    }
}
'
{
  "took" : 21,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "notebookindex_v2",
        "_type" : "_doc",
        "_id" : "urn%3Ali%3Anotebook%3A%28querybook%2C123456%29",
        "_score" : 1.0,
        "_source" : {
          "urn" : "urn:li:notebook:(querybook,123456)",
          "title" : "Test",
          "customProperties" : [ ],
          "hasDescription" : true,
          "description" : "test",
          "tool" : "querybook",
          "browsePaths" : [
            ""
          ]
        }
      }
    ]
  }
}
g
PS- i find elasticvue to be a helpful tool for introspecting elasticsearch instances: https://elasticvue.com/
ah ok-- looks like its in there for sure.
g
Yup:
Copy code
isSearchEnabled = () => true;

    isBrowseEnabled = () => true;

    isLineageEnabled = () => true;

    getAutoCompleteFieldName = () => 'name';

    getPathName = () => 'notebook';

    getEntityName = () => 'Notebook';

    getCollectionName = () => 'Notebook';
(Sorry, I know debugging like this is hard 😞 )
g
Ok- I can hop on a call in ~30 mins if you want, that might be easier
g
🙇🏽 Thanks! That would work for me Can hop in here in 30 mins: https://meet.google.com/qdz-mvys-itz?authuser=0 Or which ever meeting tool of choice
@green-football-43791, gonna hop into the hangout now. Feel free to join whenever
g
hey- now is good for me too
cc @red-napkin-59945
creating key classes:
Copy code
@dataclasses.dataclass
class DatahubKey:
    def guid(self) -> str:
        nonnull_dict = {k: v for k, v in self.__dict__.items() if v}
        json_key = json.dumps(
            nonnull_dict,
            separators=(",", ":"),
            sort_keys=True,
            cls=DatahubKeyJSONEncoder,
        )
        md5_hash = hashlib.md5(json_key.encode("utf-8"))
        return str(md5_hash.hexdigest())


@dataclasses.dataclass
class PlatformKey(DatahubKey):
    platform: str
    instance: Optional[str]


@dataclasses.dataclass
class DatabaseKey(PlatformKey):
    database: str


@dataclasses.dataclass
class SchemaKey(DatabaseKey):
    schema: str
you probably want
Copy code
@dataclasses.dataclass
class NotebookKey(PlatformKey):
    notebook_id: str
NotebookKey.pdl:
Copy code
namespace com.linkedin.metadata.key

@Aspect = {
  "name": "notebookKey"
}
record NotebookKey {
	/**
	* Unique guid for container
	*/
	guid: optional string
}
the rest of your properties would go in NotebookProperties like ContainersProperties aspect:
g
Thanks for the help on this yesterday Gabe! Once we set the Paths, things started to show up in browse!
g
woohoo 🥳
l
can you please share your code, how you inserted your notebook. My not showing on search page but inserted fine.
b
same for me