How to Integrate Metrics Into Your Search

  • Integrating metrics into your search gives you the power to find data based on aggregations of information stored in Elastic.
  • This functionality works on top of Elastic's aggregation capability and in combination with the collapsing functionality.
  • The Elastic Aggregator stage is a native, built-in stage that works on top of the Elastic backend.
  • The stage has to be added both as a Query and Results stage.

Pipeline Stages

  • A Results stage has to be added first on the list with pipeline stages, because it is an Elastic translator stage.
  • A Query stage has to be added last on the list with pipeline stages, after the Elastic translator stage.

Stage Parameters

  • For every search interface (every content by search and main search results) add a new set of Elastic Aggregator stages.
  • Separate the execution flow by specifying a different Result source ID.

Parameter Default Value Description

Related record property

<no default>

This is the name of the elastic property that is used to calculate how to attach aggregated values to the search results.

Example:

  • _PEOPLENAME

  • _MATTERID

Maximum number of records

500

This is the maximum number of records returned. This is needed, in order to re-sort the results based on the aggregation via post-processing.

Result source ID

<no default>

Enables you to restrict the stage to execute only on some queries based on the matching result source ID.

Aggregation JSON

<no default>

  • The following is a JSON representation of the Elastic Query that will be merged with the normal Elastic query built at search time.
  • The JSON has priority so if it defines a “key” that already exists in the Elastic query request, it overrides it.
Example
Copy
{
  "aggs": {
    "hoursByPeople": {
      "terms": {
        "field": "_PEOPLENAME",
        "size": 2147483647
      },
      "aggs": {
        "workedhours": {
          "sum": {
            "field": "_WORKEDHOURS"          }
        }
      }
    }
  }
}
  • workedhours are added as a property of each result returned by the Elastic backend and can be used in your search center.
Copy
{
  "aggs": {
    "hoursByMatter": {
      "terms": {
        "field": "_MATTERID",
        "size": 2147483647
      },
      "aggs": {
        "matterworkedhours": {
          "sum": {
            "field": "_WORKEDHOURS"          }
        }
      }
    }
  }
}
  • matterworkedhours are added as a property of each result returned by the Elastic backend and can be used in your search center.