Query Reports

User query data is stored in elasticsearch with the index name querylogs, it can be viewed by accessing https://localhost:9200/_cat/indices.

The data related to queries in the index can be accessed here https://localhost:9200/querylogs/_search?pretty=true.

Viewing Queries in Kibana

  • You can use Kibana to view and search the queries stored in the querylogs index in OpenSearch. Kibana also allows you to create reports based on these queries.
  • In Kibana settings, you must add the index name querylogs to access this data.

You can search and generate reports after adding the querylogs index in Kibana.

📘

To get to know more about Kibana in SearchBlox please check the link:
Kibana Visualizations

Deleting or clearing data from querylog index

Data stored in the querylogs index, which contains search queries saved in OpenSearch, can be deleted from Kibana by sending a delete request through Dev Tools.

  • Open Kibana and go to Dev Tools.

  • Use the following POST request to delete all data from the querylogs index:
POST querylogs/_delete_by_query
{
  "query": {
    "match_all": {}
  }
}
  • If you want to delete the data based on a specific date range, send a POST request with the date range included, as shown in the example.
POST querylogs/_delete_by_query
{
 "query": {
 "range" : {
 "created" : {
 "gte" : "2020-01-01T00:00:00",
 "lt" : "2020-06-12T00:00:00"
 }
 }
 }
}

The response would be:

Viewing Queries From Logs

The following log files contain the entry data for searches made in SearchBlox by all users.

  • query.log: This file contains every search query entered by users.
  • data.log: This file contains the indexed data that is recorded based on user searches.
    These log files are available here: <SEARCHBLOX_INSTALLATION_PATH>/webapps/searchblox/logs

🚧

Important Information:

Query logs are deleted that is, log rotation is done once every 14 days.

Query Suggestion Service

For customizing query suggestions, you can make a CSV file that contains a list of queries you want to support for suggestions. Add a column heading called querystring in your CSV file.
Index this custom CSV file using a CSV collection, and set the UniqueID field to querystring.

Use the AutoSuggest API endpoint to test suggestions for your collection by sending the cname parameter with your collection name.
https://localhost:8443/rest/v2/api/autocomplete?limit=5&query=lat&cname=<CSV_collection_name_here>

Reference: https://developer.searchblox.com/docs/autosuggest