20 September 2018 Engineering

Introducing the Analytics API Suite in Elastic App Search

By Kellen EvanIoana Tagirta

Elastic App Search now features a robust Analytics API suite. The Analytics API suite can help you gain valuable insight into the clicks and queries generated during a users’ search experience.

Are analytics valuable? How can you use them to further improve search relevance and the overall experience? Is the suite difficult to use? Continue on to explore these questions. Otherwise, feel free to dive right into the Analytics documentation to start weaving helpful search analytics into your applications.

Express Yourself

Quality search provides two key benefits. The first is clear: you provide an expedient mechanism to connect visitors with the data they seek. Within internet business, there is great value in getting people where they want to go, as fast as possible. Whether they want to find a product, read an article, or investigate the right service, speedy acquisition of desired information is lucrative.

The second benefit is less obvious, but within it lies vast potential. Analyzing search patterns reveals deep insight into not just what, but how your users are searching. How do they form their queries? What language do they use, which common terms? How do user searches impact the achievement of business goals? Upon reflection, what are the unseen barriers that you have placed before your users?

Above all other forms of information discovery, search is unique in that it begins with a free expression. A user sees naught but an empty search bar and into this blank canvas they sail their free flowing ideas.

It is through analyzing this expression that we unveil great insight that can help us get ahead of the searcher, anticipating not only which content they might be seeking but supporting however they might be seeking it.

Analytical Magic

To wrap our heads around the value of the Analytics API suite, we will put it into context. When a user performs a search, they create a query.

The query informs us of the value — the words, numbers, dates, or coordinates — used during the search. A query will generate results and if the result content is relevant then the user will produce a click upon engagement.

As we head into the realm of the practical, consider that we have an Elastic App Search Engine called book-of-magic. This Engine provides search within our Book of Magic application. We have a full repository of magical spells and various sorceries — for the modern witch or warlock - of today.

We can use the Analytics suite to perform queries at the Engine level. If we wanted to find the top 10 queries over the past 7 days, we can build a simple GET request against the analytics/queries endpoint...

curl -X GET 'https://host-2376rb.api.swiftype.com/api/as/v1/engines/book-of-magic/analytics/queries' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer private-xxxxxxxxxxxxxxxxxxxxxxxx'

In return, we receive an array of our top 10 results and some metadata:

"results": [
    {
      "term": "fire",
      "clicks": 2204,
      "queries": 24838
    },
    {
      "term": "youth",
      "clicks": 1111,
      "queries": 49489
    },
    ## Truncated!
  ],
  "meta": {
    "page": {
      "size": 10,
      "current": 1
    }
  }
}

Our results array informs exact queries, as typed by the user. We see that the two most popular queries over the past 7 days are fire and youth. By looking only at these two results, we already see something valuable.

The term youth generated 24,651 more queries than fire, yet generated 50% less clicks. Hmm - perhaps our youth generating spells are not up to par — a potential area of improvement has been revealed.

Let us explore deeper into the youth query to form a better understanding. This time, we will request against the analytics/clicks endpoint and specify just the youth query:

{
  "results": [
    {
      "document_id": "41384",
      "clicks": 50
    },
    {
      "document_id": "49109",
      "clicks": 40
    },
    {
      "document_id": "44343",
      "clicks": 21
    },
    {
      "document_id": "321",
      "clicks": 0
    }
  ],
  "meta": {
    "page": {
      "size": 4,
      "current": 1
    }
  }
}

We can see each document that would appear for that query, defined by document_id. A curio: document #321 is one of our best and most effective spells, yet it has 0 clicks — that should not be! We have identified an issue. Luckily, Elastic App Search can help you transform realization into useful action.

The Analytics suite is ideal for revealing issues of this nature. You know that people searching for youth would benefit from document #321. But they are not finding it. To fix this and improve your clicks, we could consider altering the title and subtitle of the document to make it more appealing. Or, we could apply a Curation through the API or the dashboard to promote document #321 as the first result for the youth query.

image1.png

A final Analytics angle involves counts. The anaytics/queries and analytic/cicks endpoints provide specific values. Requesting against analytics/counts will instead give us a window into the general performance of search:

{
  "results": [
    {
      "clicks": 55383,
      "queries": 98409,
      "from": "2018-09-01",
      "to": "2018-09-02"
    },
    {
      "clicks": 53822,
      "queries": 87489,
      "from": "2018-07-02",
      "to": "2018-07-03"
    },
    {
      "clicks": 59098,
      "queries": 91487,
      "from": "2018-07-03",
      "to": "2018-07-04"
    },
      ## Truncated!
  ]
}

Ah... it seems that roughly ~60% of queries result in clicks. While the large number of queries indicates that the hunt for magic is alive and well, we can surely improve the likelihood that a user will click on a search result — and thus help us achieve our business goals.

Summary: Conjuring Clicks

The Analytics suite is packed full of filters and parameters that enable valuable and flexible insight into what is happening within your Elastic App Search Engine. By refining your knowledge of user search patterns, you can apply Curations, Synonyms, and Weights and Boosts to fine-tune what is a already an optimized search experience.

To get even deeper into analytics, there are two other key features you can use to enrich data collection. The Clickthrough API can supplement the data that you receive when a user clicks on a result. In conjunction with Tags, which can be included within search and analytics queries, important questions can be answered about each click: Which browser is being used? Is the user on mobile? Does the user have an account?

You can jump right into Elastic App Search with a free 14-day trial — no credit card required. Providing a relevant, fluid, and dynamic search experience is just the beginning. Learning about your users, then adapting to and pre-empting their habits, is when search can truly help your applications take off.