<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div>
<h2>How to optimize data loading using subqueries in Elasticsearch</h2>
<p>
This example demonstrates how to load the data from Elasticsearch faster.
</p>
<p>
Using the <code>dataSource.subquery</code> property, you can set a server-side filter for your data. As a result, Flexmonster will get only the needed subset of the data. In this example, we load specific members of the <code>Category</code> and <code>Color</code> fields (lines 12-26 in the JavaScript box).
</p>
<p>
<a href="https://www.flexmonster.com/doc/connecting-to-elasticsearch/" target="_blank">See our documentation for more details on connecting to Elasticsearch</a>.
</p>
</div>
<div id="pivot-container"></div>