Questions about getting relations etc


(kampfgnu) #1

hi group!

we have two entities: 'Item' and 'ItemDescription'.
the 'Item' has two properties: 'id' and 'isActive'
the 'ItemDescription' has three properties: 'id', 'title' and 'item_id'

is there a way to implement the following scenarios?

  • when searching for text contained in ItemDescription.title, we would like
    to let elasticsearch return the 'Item' entities of the found
    'ItemDescription' entities
  • return only 'Item' entities where Item.isActive = true

thanks, kampfgnu

--


(David Pilato) #2

Think "document" and not RDBMS anymore.
Create a single type named Item and add all properties in it:
Active
Title

Your use case seems to be: "find items". So if you are searching for items, index items, not other stuff that you are not directly looking for.

My 2 cents.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 23 août 2012 à 10:54, kampfgnu tut.ench.amok@gmail.com a écrit :

hi group!

we have two entities: 'Item' and 'ItemDescription'.
the 'Item' has two properties: 'id' and 'isActive'
the 'ItemDescription' has three properties: 'id', 'title' and 'item_id'

is there a way to implement the following scenarios?

  • when searching for text contained in ItemDescription.title, we would like to let elasticsearch return the 'Item' entities of the found 'ItemDescription' entities
  • return only 'Item' entities where Item.isActive = true

thanks, kampfgnu

--


(kampfgnu) #3

thanks for your answer, david.

the reason we try to achieve this scenario:
we have multilanguage support in our system.
so the user can create an item and add multiple descriptions for it in
different languages.
so we split the textual description into a seperate entity ItemDescription.
this should allow us to find the item no matter in what language the user
searches for it.

maybe this solution to support multilanguage search results is not cool, we
aren't sure, but can't find another solution to address this problem

greetz

--


(David Pilato) #4

I think you should look at the multifield feature. It could help for this use case.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 23 août 2012 à 11:23, kampfgnu tut.ench.amok@gmail.com a écrit :

thanks for your answer, david.

the reason we try to achieve this scenario:
we have multilanguage support in our system.
so the user can create an item and add multiple descriptions for it in different languages.
so we split the textual description into a seperate entity ItemDescription.
this should allow us to find the item no matter in what language the user searches for it.

maybe this solution to support multilanguage search results is not cool, we aren't sure, but can't find another solution to address this problem

greetz

--


(system) #5