Force query on field

Hi guys,

Is there any config in ElasticSearch, any plugin, any feature in x-pack or something on elastic cloud, that forces users to have one condition on its query automatically?

I'm trying to force that user add one condition "customer_id: " to identify my customer data among all data from all customers. I wish I could use x-pack feature to automatically add this query based on user metadata, but in my database I have 5k customers and growing, and I do not want to intercept my queries in the backend, add this condition and query ES. I'd like to query from my javascript application.

So, if the user makes a query without this condition, I'd return no results for him.

Thank you,

[]s,

Lucas

Using document-level security in X-Pack, you can create roles that contain this criteria. You can then assign a separate role to each customer so that they only can see the appropriate data. You can also use templating to simplify this mechanism. This is described in this blog post.

Hi Christian! Thanks for replying. Yes, this was my first approach and probably the best one! :slight_smile:

The fact is that I'll have one customer user in elasticsearch for each one in my database. Will this scale? I'm talking about 3k users today and ramping up to reach 5k in the next 12~18 months.

Do you think this can be an issue? I'm using ElasticSearch in Elastic Cloud (SaaS).

Thank you!

Hi @Christian_Dahlqvist, any thoughts on this?

Thank you,

As far as I know that should work.

Thanks a lot! :slight_smile:

Will continue on this.

[]s,

Lucas

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.