Diving Into Entity Search Results

Recently I was inspired by Mike’s post, ‘Leveraging Machine-Readable Entity ID’s for SEO’, which if you haven’t checked out already you definitely should. Mike’s post shines a light on MREID’s (described as a canonical URI for an entity, issued and used by Google) and how we can look to using them for SEO. To quote Mike’s post:

A machine-readable entity ID is, in essence, a string of characters used to exclusively refer to a single entity.

According to Bill Slawski — and thanks to his tireless work analyzing Google Patents, plus, generally paying more attention than anyone else — we know that Google is using MREID across many services like Google Trends, Google Lens, and Google Reverse Image Search (to keep track of entities within images).

Once I understood what machine-readable entity IDs were (here’s an example of the one for Seattle: /m/0d9jr), I had to know more.

At first, I set out to understand if there was any rhyme or reason to the alphanumeric structure assigned to any given entity, in case that uncovered anything interesting. To cut to the chase, from my research, the short answer is: no, I don’t think so. I ended up down a rabbit hole on Google and uncovered numerous large datasets of entity IDs, and after comparing these numbers in various combinations for hours, I could not find any significant correlation.

Regardless, I still wanted to explore MREID’s further, and good news, I found a way to uncover MREID’s, supported schema-types, and auto-generate sameAs JSON-LD snippets (to help associate relevant pages on sites with entities that Google recognizes) for multiple entities, that I defined. In doing this I also found different ways to explore an entity, which opened up the opportunity to elevate content strategies by incorporating related associations of an entity as seen through Google’s lens, so to speak.

So let’s dive right into the details!

Using the Knowledge Graph Search API

At first I tried to extract MREID’s from the Google SERP using XPaths and Screaming Frog. After what seemed like days of attempts, I accepted that this was not the way to go. I gave in, and I finally decided to take advantage of the Knowledge Graph Search API instead.

Getting an API Key

Before you can send requests to Google Knowledge Graph Search API, you need to have access to the API using a unique key. Spoiler alert: this is something you’ll need shortly too.

To attain an API key, you’ll need to first create a project in the Google Developers Console. Once your project is created you will want to click the button that reads Enable APIS and Services:

Then you simply perform a search for Knowledge Graph, it should be the only result that populates.

Next – click ENABLE

Once enabled you’ll be redirected to a dashboard, and you should see Credentials on the left menu panel. Click that and then choose API key from the Create credentials dropdown.

From there you should have a shiny new API key to play around with!

Gathering Multiple Machine-Readable Entity IDs

Now that we have an API key, we can make requests and extract data from the Knowledge Graph using a simple HTTP request. Go ahead and place your API key where it reads API_KEY, and put the whole URL below into your browser:

https://kgsearch.googleapis.com/v1/entities:search?query=taylor+swift&key=API_KEY&limit=1&indent=True

You should be returned a JSON-LD result (as shown below) containing information used in the Knowledge Graph for Taylor Swift.

You had a blank space, baby, and now you have Taylor Swift’s MREID! Pretty neat!

From here, the next step was to find a way to do this quickly, easily, and at scale.

Introducing the Knowledge Graph Entity Search Engine

Scrolling down a little further on the Knowledge Graph Search API documentation, there are example codes on how to make API requests using Python, Java, Javascript, and PHP. Fortunately, PHP is in my wheelhouse, and after some fine tuning I managed to put together the Knowledge Graph Entity Search engine.

With this engine, you can type a single query/entity name, input your API key and you will be returned a user-friendly interface with 20 total results in descending order of Google’s result score, a numerical indicator of how well the entity matched the query request constraints.

How to use the Knowledge Graph Entity Search engine

If you haven’t already, you can use your API key to use this engine, here’s how:

  1. Go here: https://www.upbuild.io/tools/entity-search/
  2. Enter your query/name of an entity
  3. Enter your API key
  4. Submit

That’s it!

Here’s what happens when you search for ‘seattle

For each entity result returned you will be provided the following information:

Entity name
The name of the entity.

Entity description
A short description of the entity.

Image
An image to help identify the entity.

Wikipedia URL
The associated Wikipedia URL for the entity, if available.

Official Entity URL
The official website URL of the entity, if available.

View Knowledge Graph button
This will limit a Google Search to just display the Knowledge Graph for the entity.

Claim Entity Button
This leads you to the claim page for the entity, and while it’s highly unlikely that you’ll be using this to claim any entity that isn’t, perhaps yourself, it’s still fun to search and peek behind the curtain. Here’s what happens when you click the Claim Entity button for the query stranger things:

MREID
The canonical URI for the entity.

Result Score
An indicator of how well the entity matched the request constraints.

Schema.org types
The list of supported schema.org types that match the entity.

sameAs snippet
The JSON-LD sameAs snippet pointing to the Knowledge Graph Machine-ID for the entity. If a Wikipedia URL is available for the entity it will include that within the sameAs snippet also.

Searching for Multiple Entities

Now we can utilize the Knowledge Graph Entity Search engine in combination with the Screaming Frog SEO Spider and custom Xpath extractions to generate MREID’s, schema types, and sameAs code snippets for multiple queries at once.

Now, let’s get set up and learn how to use the Entity Search URL Generator:

  1. First, click here to make yourself a copy of the Entity Search URL Generator
  2. Enter your API key (in cell C20)
  3. Enter your target queries in column B (starting at cell B24).
  4. Next you’ll open up Screaming Frog and under Configuration > Custom > Extraction, enter the following Xpaths (you’ll want to extract Text):

Entity Name
(//*[@class=’entity-name’])[1]

MREID
(//*[@class=’mreid’])[1]

Schema Type
(//*[@class=’type’])[1]

sameAs
(//*[@class=’same-as’])[1]

  1. Now take the generated URLs from the Entity Search URL generator and upload them to Screaming Frog in List Mode – and hit Start!
  2. Now when you navigate towards the Custom Extraction section you should see something like this:

Using the Entity Search Tool for Content

Aside from using this tool to quickly generate entity data, you could also use the Knowledge Graph Entity Search engine as a standalone tool for content creation ideas.

Let’s say you’re in the travel industry and you want to write an article about Seattle. First, let’s type in ‘seattle’, and scroll down to the next result on the page you should see an entity result for the Seattle Mariners.

After that result, you see Seattle Seahawks, Seattle International Film Festival, Seattle Chinatown-International District and so much more. All great topics of interest to explore. This is a good opportunity to also let you know that you can filter these results by schema.org type. So if you only wanted to see entity results that only fall under a certain schema type you can do so simply by clicking on the schema type shown on any entity card. If we click on ‘Sports Team’ type, for example, you’ll see the filter happen:

Ok, now let’s try typing in ‘seattle restaurant’:

Interestingly, “Bite of Seattle”, a food festival in Seattle, is returned with the highest result score, which is a stark difference from the same query when used in Google Search. The food festival notably begins July 20-22, 2018, which is just a couple of weeks away. Could a trend in search volume be a reason for this entity result to be returned for our query? We can click on the MREID for any entity result to jump straight over to Google Trends to see (and also explore related queries and topics):

There is clearly a spike in interest in July, and it’s results like these that certainly are interesting see what exactly Google associates with queries. This can help to provide a window into possible content topics that may not be overly obvious through basic keyword research.

Another feature of this engine is reverse image search for each entity result. When you click any entity result image, you will be taken to the SERP for that image result. Here’s what happens when you click on the result for seattle:

The result is interesting because it shows a Knowledge Panel for ‘Space Needle’, which, as far as I can tell, isn’t even featured in the image that we just looked up. Furthermore, ‘Space Needle’ isn’t returned in the first 20 results for the term ‘seattle’ in our engine. So this is another way to gain insight into entities that Google perceives as related.

What’s Next

Now that we have a foundation to interact with the Knowledge Graph API, we hope to continue chipping away at the information available to see just how we can connect the dots, and add more features as time goes by. In the meantime, please utilize this tool in any way you can and lets us know in the comments what you find, and we’ll be sure to do the same!

Related Posts

Leave a Reply

Your email address will not be published.