src/module-elasticsuite-tracker/etc/elasticsuite_search_request.xml
<?xml version="1.0"?>
<!--
/**
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
* versions in the future.
*
* @category Smile
* @package Smile\ElasticsuiteTracker
* @author Aurelien FOUCRET <aurelien.foucret@smile.fr>
* @copyright 2020 Smile
* @license Open Software License ("OSL") v. 3.0
*/
-->
<requests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Smile_ElasticsuiteCore:etc/elasticsuite_search_request.xsd">
<!-- Session log event aggregator request using tracking_log_event to create tracking_log_session data -->
<request name="session_aggregator" label="Session log event aggregator" index="tracking_log_event" fulltext="false">
<aggregations>
<aggregation xsi:type="termBucket" name="session_id" field="session.uid">
<aggregations>
<aggregation xsi:type="termBucket" name="visitor_id" field="session.vid" />
<aggregation xsi:type="termBucket" name="product_view" field="page.product.id"/>
<aggregation xsi:type="termBucket" name="category_view" field="page.category.id" />
<aggregation xsi:type="termBucket" name="category_view" field="page.category.id" />
<aggregation xsi:type="termBucket" name="search_query" field="page.search.query.sortable">
<!-- only collect search terms with (in average) a number of results greater than 0 -->
<!-- TODO decide if we really want to alter the session aggregation behavior in such a non-BC way -->
<metrics>
<metric name="search_result_count" type="sum" field="page.product_list.product_count" />
</metrics>
<pipelines>
<pipeline xsi:type="bucketSelectorPipeline" name="query_with_results" script="params.search_result_count > 0">
<bucketsPath>
<mapping paramName="search_result_count"><![CDATA[search_result_count]]></mapping>
</bucketsPath>
</pipeline>
</pipelines>
</aggregation>
<!-- search terms which return 0 results -->
<aggregation xsi:type="termBucket" name="search_query_void" field="page.search.query.sortable">
<filters>
<filter name="with_results">Smile\ElasticsuiteTracker\Model\Event\Search\Request\Container\AggregationFilter\WithoutSearchResults</filter>
</filters>
</aggregation>
<aggregation xsi:type="termBucket" name="product_cart" field="page.cart.product_id" />
<aggregation xsi:type="termBucket" name="product_sale" field="page.order.items.product_id" />
<aggregation xsi:type="termBucket" name="category_sale" field="page.order.items.category_ids" />
</aggregations>
<metrics>
<metric name="start_date" type="min" field="date" />
<metric name="end_date" type="max" field="date" />
</metrics>
</aggregation>
</aggregations>
</request>
<!-- Simple request for tracker events -->
<request name="tracking_log_event" label="Tracking Log Events" index="tracking_log_event" fulltext="false" track_total_hits="true"/>
<!-- Simple request for tracker sessions -->
<request name="tracking_log_session" label="Tracking Log Sessions" index="tracking_log_session" fulltext="false" track_total_hits="true"/>
</requests>