Help with how to structure data


(Scott) #1

Hi

I’m currently reviewing Found.no and have been pointed here by their support team to gain a little help on how best to structure the entries into Elasticsearch.

My situation.

I'm currently creating a business tool and I'm looking for an efficient way for customers to search their data.

  • Each customer in the tool has their own account and should only be able to access their own data. Each account can then have various pieces of information such as projects and then items such as documents, requirements etc… belonging to projects.

  • I want to be able to allow customers to search for a single project or a single document in a given project, but also allow them to do a global search to search on all projects / content in their account.

  • When users delete content, I want to be able to easily delete a single requirement, but also be able to easily delete a single project with all the content that it contains and a single account with all the projects and data that it contains.

Questions:

  1. Knowing the above, how would you suggest that I set the _index, _type & _id to be able to easily do the above searches that I mentioned are needed?

  2. In the found.no config, I’ve noticed it has a setting of ‘deletion requires name’ which defaults to wildcard. Would there be a way to perform command that does something like ‘Delete all content for this project’ or ‘Delete all content for this account’ without having to cycle over all content piece by piece.

Thanks for your help
Scott


(Mark Walkom) #2
  1. Depends, do you have different types and can you safely generate your own unique ID?
  2. You can do a scan/scroll then a bulk delete. Most people will use delete-by query here but it's being removed and replaced with this.

Generally in this sort of use case we suggest using aliases per user with a filter to limit access to their documents. That way you can have one or more indices rather than one per user.


(system) #3