Search multiple indexes with filter

We have two indexes (user, orders). We need to be able to search for user and orders in one search field. We also need to lock it down to only search based on what store the order happened. On the front end we can say what store that user can access to but that user should only be able to search the users that have orders at that store.

Hi there!

If I understood correctly you can achieve something similar by generating a secured API key for each user:

In your specific use case you could generate on your backend one key per user by filtering on the store id:

var searchOnlyApiKey = 'YOUR_SEARCH_API_KEY';

var params = {
  filters: '_tags:user_42 AND store_id = 123',
  userToken: 'user_42'

var publicKey = client.generateSecuredApiKey(searchOnlyApiKey, params);

Let me know if this helps you out.