ES for a social network application


(alheim) #1

Hi,

We build a social network application and we use ES to enable our users to
browse content with facets and text search.

Everything works fine.

Now we would like to enable the users to filter what they have read or not,
what they have starred... .

Example :

I want all the documents containing MAPPING, tagged with ES which I've not
already read, and the corresponding facets

Here comes the issue.

I'm destroying my brain thinking about a way to model this.

1- For each posts, I add a nested object containing the userId and the
readDate of ALL the readers. What if there are 100 000 users or more ?

Is it an issue for ES to manage so much nested object ?

Is it possible to retrieve only the nested object corresponding to the user
who makes the query ?

2- Use a parent child mapping. But joins are not possible. Or I miss
something.

3- Get the documents without the user's specific data and query the
database to get them. But the facet's count will be wrong.

Any idea ? I'm pretty sure I'm not the only one to have this issue.


(Shay Banon) #2

You could try and use parent child, where the child document is an user
specific document indicating if its starred or when it was read. Then, you
can use has_child filter for it.

On Fri, Apr 20, 2012 at 11:58 AM, Alexandre Heimburger <
ahb@bluekiwi-software.com> wrote:

Hi,

We build a social network application and we use ES to enable our users to
browse content with facets and text search.

Everything works fine.

Now we would like to enable the users to filter what they have read or
not, what they have starred... .

Example :

I want all the documents containing MAPPING, tagged with ES which I've not
already read, and the corresponding facets

Here comes the issue.

I'm destroying my brain thinking about a way to model this.

1- For each posts, I add a nested object containing the userId and the
readDate of ALL the readers. What if there are 100 000 users or more ?

Is it an issue for ES to manage so much nested object ?

Is it possible to retrieve only the nested object corresponding to the
user who makes the query ?

2- Use a parent child mapping. But joins are not possible. Or I miss
something.

3- Get the documents without the user's specific data and query the
database to get them. But the facet's count will be wrong.

Any idea ? I'm pretty sure I'm not the only one to have this issue.


(alheim) #3

Thanks. It's working perfectly and so fast. ES is awesome.

I should write a tutorial on how we implement a social network with ES.

On Saturday, 21 April 2012 16:56:12 UTC+2, kimchy wrote:

You could try and use parent child, where the child document is an user
specific document indicating if its starred or when it was read. Then, you
can use has_child filter for it.

On Fri, Apr 20, 2012 at 11:58 AM, Alexandre Heimburger <
ahb@bluekiwi-software.com> wrote:

Hi,

We build a social network application and we use ES to enable our users
to browse content with facets and text search.

Everything works fine.

Now we would like to enable the users to filter what they have read or
not, what they have starred... .

Example :

I want all the documents containing MAPPING, tagged with ES which I've
not already read, and the corresponding facets

Here comes the issue.

I'm destroying my brain thinking about a way to model this.

1- For each posts, I add a nested object containing the userId and the
readDate of ALL the readers. What if there are 100 000 users or more ?

Is it an issue for ES to manage so much nested object ?

Is it possible to retrieve only the nested object corresponding to the
user who makes the query ?

2- Use a parent child mapping. But joins are not possible. Or I miss
something.

3- Get the documents without the user's specific data and query the
database to get them. But the facet's count will be wrong.

Any idea ? I'm pretty sure I'm not the only one to have this issue.


(Otis Gospodnetić) #4

Hi,

On Tuesday, July 24, 2012 11:31:12 AM UTC-4, Alexandre Heimburger wrote:

Thanks. It's working perfectly and so fast. ES is awesome.

I should write a tutorial on how we implement a social network with ES.

That sounds interesting. Could you?

Otis

Search Analytics - http://sematext.com/search-analytics/index.html
Scalable Performance Monitoring - http://sematext.com/spm/index.html

On Saturday, 21 April 2012 16:56:12 UTC+2, kimchy wrote:

You could try and use parent child, where the child document is an user
specific document indicating if its starred or when it was read. Then, you
can use has_child filter for it.

On Fri, Apr 20, 2012 at 11:58 AM, Alexandre Heimburger <
ahb@bluekiwi-software.com> wrote:

Hi,

We build a social network application and we use ES to enable our users
to browse content with facets and text search.

Everything works fine.

Now we would like to enable the users to filter what they have read or
not, what they have starred... .

Example :

I want all the documents containing MAPPING, tagged with ES which I've
not already read, and the corresponding facets

Here comes the issue.

I'm destroying my brain thinking about a way to model this.

1- For each posts, I add a nested object containing the userId and the
readDate of ALL the readers. What if there are 100 000 users or more ?

Is it an issue for ES to manage so much nested object ?

Is it possible to retrieve only the nested object corresponding to the
user who makes the query ?

2- Use a parent child mapping. But joins are not possible. Or I miss
something.

3- Get the documents without the user's specific data and query the
database to get them. But the facet's count will be wrong.

Any idea ? I'm pretty sure I'm not the only one to have this issue.


(system) #5