Setting tags for entries


(Kostiantyn Kahanskyi) #1

Hello,

I would appreciate any help with the following...

I have two types: "entry" and "tag". A "tag" can be "online" or "offline"
(boolean property "online").
I want to do 2 things:

(1) For every "tag" I want to search the "entries" and if any found for a
specific "tag", I want to mark this "tag" as "online".
(2) I want to search the "entries" by an arbitrary query. And for every
found "entry" I want to display two "tags", which have been marked
"online", while searching for this "entry" in step 1.

How to do (1) I know: I just do a search in "entries" for every tag and
then update it's property "online" if any "entries" have been found.
Now the hard one: how can I achieve (2)?

Unfortunately I have hundreds of thousands of entries and thousands of
"tags". So to set for every "entry" some property of a kind "this entry was
found for the tag X" is not an option.

Thanx a lot for any kind of help!

Kind regards!
Kostia

--


(Igor Motov) #2

What if you will modify (1) to store the list of entries that caused this
tag to be "online"? Then in (2) you can first get the list of entries using
arbitrary query and then for each entry you can execute a search to get two
corresponding tags. With multi search API it can be implemented with only
two round trips to the elasticsearch server.

On Monday, October 22, 2012 5:33:49 PM UTC-4, Kostiantyn Kahanskyi wrote:

Hello,

I would appreciate any help with the following...

I have two types: "entry" and "tag". A "tag" can be "online" or "offline"
(boolean property "online").
I want to do 2 things:

(1) For every "tag" I want to search the "entries" and if any found for a
specific "tag", I want to mark this "tag" as "online".
(2) I want to search the "entries" by an arbitrary query. And for every
found "entry" I want to display two "tags", which have been marked
"online", while searching for this "entry" in step 1.

How to do (1) I know: I just do a search in "entries" for every tag and
then update it's property "online" if any "entries" have been found.
Now the hard one: how can I achieve (2)?

Unfortunately I have hundreds of thousands of entries and thousands of
"tags". So to set for every "entry" some property of a kind "this entry was
found for the tag X" is not an option.

Thanx a lot for any kind of help!

Kind regards!
Kostia

--


(Kostiantyn Kahanskyi) #3

Hello,

thanx a lot for the quick response! :-)))

Great idea!
But if I would do what you suppose, it would mean, that there will be
"tags" with about 4.000 ids of "entries". Could it be a performance problem?

Thanx a lot!
Kostia

Am Dienstag, 23. Oktober 2012 00:17:56 UTC+2 schrieb Igor Motov:

What if you will modify (1) to store the list of entries that caused this
tag to be "online"? Then in (2) you can first get the list of entries using
arbitrary query and then for each entry you can execute a search to get two
corresponding tags. With multi search API it can be implemented with only
two round trips to the elasticsearch server.

On Monday, October 22, 2012 5:33:49 PM UTC-4, Kostiantyn Kahanskyi wrote:

Hello,

I would appreciate any help with the following...

I have two types: "entry" and "tag". A "tag" can be "online" or "offline"
(boolean property "online").
I want to do 2 things:

(1) For every "tag" I want to search the "entries" and if any found for a
specific "tag", I want to mark this "tag" as "online".
(2) I want to search the "entries" by an arbitrary query. And for every
found "entry" I want to display two "tags", which have been marked
"online", while searching for this "entry" in step 1.

How to do (1) I know: I just do a search in "entries" for every tag and
then update it's property "online" if any "entries" have been found.
Now the hard one: how can I achieve (2)?

Unfortunately I have hundreds of thousands of entries and thousands of
"tags". So to set for every "entry" some property of a kind "this entry was
found for the tag X" is not an option.

Thanx a lot for any kind of help!

Kind regards!
Kostia

--


(Igor Motov) #4

Could it be a performance problem? It really depends on your requirements,
available hardware and how often you are planning to update this
index. Indexing a tag with 4000 ids would be roughly equivalent to indexing
a document with 4000 words, which elasticsearch can easily handle. But if,
for example, you have near real-time requirements, performance, indeed,
might be an issue.

On Monday, October 22, 2012 6:33:53 PM UTC-4, Kostiantyn Kahanskyi wrote:

Hello,

thanx a lot for the quick response! :-)))

Great idea!
But if I would do what you suppose, it would mean, that there will be
"tags" with about 4.000 ids of "entries". Could it be a performance problem?

Thanx a lot!
Kostia

Am Dienstag, 23. Oktober 2012 00:17:56 UTC+2 schrieb Igor Motov:

What if you will modify (1) to store the list of entries that caused this
tag to be "online"? Then in (2) you can first get the list of entries using
arbitrary query and then for each entry you can execute a search to get two
corresponding tags. With multi search API it can be implemented with only
two round trips to the elasticsearch server.

On Monday, October 22, 2012 5:33:49 PM UTC-4, Kostiantyn Kahanskyi wrote:

Hello,

I would appreciate any help with the following...

I have two types: "entry" and "tag". A "tag" can be "online" or
"offline" (boolean property "online").
I want to do 2 things:

(1) For every "tag" I want to search the "entries" and if any found for
a specific "tag", I want to mark this "tag" as "online".
(2) I want to search the "entries" by an arbitrary query. And for every
found "entry" I want to display two "tags", which have been marked
"online", while searching for this "entry" in step 1.

How to do (1) I know: I just do a search in "entries" for every tag and
then update it's property "online" if any "entries" have been found.
Now the hard one: how can I achieve (2)?

Unfortunately I have hundreds of thousands of entries and thousands of
"tags". So to set for every "entry" some property of a kind "this entry was
found for the tag X" is not an option.

Thanx a lot for any kind of help!

Kind regards!
Kostia

--


(system) #5