List of items

(Honzabrecka) #1

Hi, I'm standing before the following problem. I want to implement a feature called "sets", which means I have a blog posts and a set of blog posts. Each blog post can be present in N sets. Search result should contain a mix of blog posts and sets of blog posts, sorted by relevancy.

blog is an entity with the following keys:
{id, name, text}

set is an entity with the follwing structure:
{id, name, blogs: []}

How would you index this data in ElasticSearch, to be efficient to both read and write?

I would save everything as a set (with some metadata that would contain an information if it's real set or not - the case with one blog in set), but update would be expensive - get all sets where the blog is present, update them and save. On the other hand, search works exactly as I want with just one query. Please, advice if there's a better solution.


(David Pilato) #2

I would probably start with indexing blogs and not sets:

  set: {

Would this work for you?

(system) #3