---
updatedAt: 2026-09-28T14:15:06.000Z
agentTools:
  projectIndex: https://developer.searchblox.com/v10.2/llms.txt
---

# Analytics Logs

Top Clicked or Viewed data is stored in Elasticsearch with the index name idx9998. The index would be listed here as in the screenshot: <https://localhost:9200/_cat/indices>.

From 9.2 onwards we also have one more index called click where we store individual URLs and the click count for the same.

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/7cfc68e-click_index.png",
        "click_index.png",
        553,
        174,
        "#cccccc"
      ]
    }
  ]
}
[/block]

* The data in the index can be accessed here:
  <https://localhost:9200/idx9998/_search?pretty=true>
  <https://localhost:9200/click/_search?pretty=true>

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/5132f96-topclicked.png",
        "topclicked.png",
        698,
        679,
        "#f7f7f8"
      ],
      "caption": "idx9998 index output"
    }
  ]
}
[/block]

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/283f129-clickindex.png",
        "clickindex.png",
        808,
        606,
        "#fafafa"
      ],
      "caption": "click index output"
    }
  ]
}
[/block]

[block:callout]
{
  "type": "danger",
  "body": "* Only documents or URLs clicked from Faceted Search can be recorded in Top Clicked index.\n* Not applicable for regular search results.",
  "title": "Important Note:"
}
[/block]

\##**Viewing Top Viewed/Clicked Results in Kibana**

* Top Clicked Results are stored in a separate index, called idx9998, within Elasticsearch in SearchBlox. Kibana can be used to view these Top Clicked Results, search these results, and generate reports based on the Top Clicked Results.
* The index query name that has to be added in Kibana is `idx9998` for Top Clicked Results.
* If you want to add index 'click' you can add that name using the following steps:

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/3e311ff-topclicked1.png",
        "topclicked1.png",
        1341,
        609,
        "#dae6ec"
      ]
    }
  ]
}
[/block]

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/0b9d450-topclicked2.png",
        "topclicked2.png",
        1350,
        571,
        "#d9e5ec"
      ]
    }
  ]
}
[/block]

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/cdab6b2-topclicked3.png",
        "topclicked3.png",
        1345,
        658,
        "#dae6ec"
      ]
    }
  ]
}
[/block]

* Top Clicked results can be viewed and searched after adding index idx9998 in Kibana.

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/c89cc09-topclicked4.png",
        "topclicked4.png",
        1341,
        650,
        "#d6e2e7"
      ]
    }
  ]
}
[/block]

[block:callout]
{
  "type": "info",
  "body": "To get to know more about Kibana in SearchBlox please check the following link:\n[Kibana Visualizations](https://developer.searchblox.com/docs/kibana-visualizations) and Explore"
}
[/block]

\##**Top Clicked Data Analysis**
\###API to Increment Click Count from Search

* SearchBlox uses the following API URL to ReportServlet to increase the click count.
* The click count will be incremented in the indexed document as well as click log index idx9998.
* We also update in one more index called click which is available from version 9.2 onwards.
  <https://localhost:8443/searchblox/servlet/ReportServlet?addclick=yes&col=10&query=test&title=title&uid=11b77586c75556e161a6a71a451d6744&url=https://www.searchblox.com>

[block:parameters]
{
  "data": {
    "h-0": "parameters",
    "h-1": "Description",
    "0-0": "addclick",
    "0-1": "yes\nThe value for this field should be yes",
    "1-0": "col",
    "1-1": "collection number",
    "2-0": "query",
    "2-1": "Search query",
    "3-0": "title",
    "3-1": "title of the document from JSON results",
    "4-0": "uid",
    "4-1": "uid of the document from JSON results",
    "5-0": "url",
    "5-1": "url of the document from JSON results"
  },
  "cols": 2,
  "rows": 6
}
[/block]

\###Integration of the Search Click Count API in Faceted Search
Using Axios we are calling those API's in `plugin\src\sb\Common\SbCore.js`
We are providing the sample code here so that you can use something similar for your custom search at your end.

[block:code]
{
  "codes": [
    {
      "code": "export const getDocumentClickCount = (parameters) => {\n  let urlParameters = Object.assign({}, qs.parse(window.location.search));\n  if(Object.keys(parameters).length !== 0){\n    parameters.query = urlParameters.query;\n    // console.log(parameters,\"params\")\n    return axios.get(defaults.pluginDomain + \"/searchblox/servlet/ReportServlet?addclick=yes&col=\"+parameters.col+\"&query=\"+parameters.query+\"&title=\"+parameters.title+\"&uid=\"+parameters.uid+\"&url=\"+parameters.url)\n    .then((response)=>{\n      return response;\n    })\n    .catch((error)=>{\n      return error;\n    });\n  }\n};",
      "language": "javascript"
    }
  ]
}
[/block]

\###API for Capturing AutoSuggest Click Count

* SearchBlox uses the following API URL to ReportServlet to update the autosuggest click count
  <https://localhost:8443/searchblox/servlet/ReportServlet?addsuggest=yes&query=test&suggestion=test>
* If there is collection parameter in the URL that can be sent using the parameter col as shown:
  <https://localhost:8443/searchblox/servlet/ReportServlet?addsuggest=yes&query=test&suggestion=test&col=1>

[block:parameters]
{
  "data": {
    "h-0": "Parameter",
    "h-1": "Description",
    "0-0": "addsuggest",
    "0-1": "yes\nThe value for this field should be yes",
    "1-0": "query",
    "1-1": "search query",
    "2-0": "suggestion",
    "2-1": "search suggestion",
    "3-0": "col",
    "3-1": "collection number"
  },
  "cols": 2,
  "rows": 4
}
[/block]

\###Integration of the Autosuggest click API in Faceted Search
Using axios we are calling those API's in `plugin\src\sb\Common\SbCore.js`
We are providing the sample code here so that you can use something similar for your custom search at your end.

[block:code]
{
  "codes": [
    {
      "code": "\nexport const getSuggestClickCount = (parameters) => {\n  let urlParameters = Object.assign({}, qs.parse(window.location.search));\n  if(Object.keys(parameters).length !== 0){\n    if(urlParameters.query === undefined) {\n      parameters.query = parameters.suggest;\n    }\n    else {\n      parameters.query = urlParameters.query;\n    }\n    if(parameters.query.indexOf('\"') >= 0) {\n      parameters.query = parameters.query.replace(/['\"]+/g, '');\n    }\n    let colArray = [];\n    let colString = \"\";\n    if(defaults.defaultCollections.length > 0){\n      colArray = defaults.defaultCollections.slice();\n    }\n    else if(urlParameters.col && urlParameters.col.constructor === Array) {\n      colArray = urlParameters.col.slice();\n    }\n    else if(urlParameters.col && urlParameters.col.constructor === String) {\n      colArray.push(urlParameters.col);\n    }\n    if(colArray !== null && colArray !== undefined && colArray !== \"\" && colArray.length > 0) {\n      colArray.map((value,key) => {\n        colString = colString + \"&col=\" + value;\n      });\n    }\n    return axios.get(defaults.pluginDomain + \"/searchblox/servlet/ReportServlet?addsuggest=yes&query=\"+parameters.query+\"&suggestion=\"+parameters.suggest+colString)\n    .then((response)=>{\n      return response;\n    })\n    .catch((error)=>{\n      return error;\n    });\n  }\n};\n\n",
      "language": "javascript"
    }
  ]
}
[/block]

\##**Deleting or Clearing Data for Top Clicked Documents**
Data in the Top Clicked index that is, `idx9998` stored in elasticsearch index can be deleted from Kibana using Dev Tools by sending a clear request to elasticsearch.

* Go to Kibana and access Dev Tools

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/85fde28-querylogs.png",
        "querylogs.png",
        1243,
        593,
        "#d8e5ea"
      ]
    }
  ]
}
[/block]

* Give the following POST request to clear all the data from topclicked index `idx9998`

[block:code]
{
  "codes": [
    {
      "code": "POST idx9998/_delete_by_query\n{\n  \"query\": {\n    \"match_all\": {}\n  }\n}",
      "language": "json"
    }
  ]
}
[/block]

* If you want to clear the entries in click index please replace `idx9998` with `click`.

[block:code]
{
  "codes": [
    {
      "code": "POST click/_delete_by_query\n{\n  \"query\": {\n    \"match_all\": {}\n  }\n}",
      "language": "text"
    }
  ]
}
[/block]

* If you want to delete using date range then give the POST request with date range as shown.

[block:code]
{
  "codes": [
    {
      "code": "POST idx9998/_delete_by_query\n{\n \"query\": {\n \"range\" : {\n \"created\" : {\n \"gte\" : \"2020-01-01T00:00:00\",\n \"lt\" : \"2020-06-12T00:00:00\"\n }\n }\n }\n}",
      "language": "json"
    }
  ]
}
[/block]

The response would be:

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/31bf426-topviewed.png",
        "topviewed.png",
        1336,
        610,
        "#d6e3e9"
      ]
    }
  ]
}
[/block]