0

DISCLAIMER: I've never been a DB guru. And I'm only getting started with Elastic Search. :)


I'm creating a Dictionary-type Database.

In MySQL terms, I'd have a table of "Words", like this:

|-------------------
| Words
|-------------------
| id
| name
| part_of_speech
| language
|-------------------

And a table of "Translations", linking words together like:

|-------------------
| Translations
|-------------------
| word_a_id
| word_b_id
| sense
|-------------------

How could that be migrated to Elastic Search?

I have created an index dictionary with a type word.

How could I set a translations table and still keep the references to the existing "words" ? Am I missing something conceptual?

Dr.Kameleon
  • 22,532
  • 20
  • 115
  • 223

1 Answers1

1

ElasticSearch is conceptually document-based, not relation-based. One possible way to achieve what you want would be to create "translation" index, where every entry would contain a set of nested "word - POS - language" pairs and a "meaning" field. Then you could search this index for every entry containing a given word.

Alternatively, you could consider "word" a child document of a "translation". That would be more similar to your current approach. In ElasticSearch, you would have to look up the parent translation of the given word, and then to make another call to find a child word for that translation that belongs to the given language.

I can't tell if this is the most useful translation approach though, because words have multiple meanings and for different languages they don't completely overlap, but that is a different topic.

Ashalynd
  • 12,363
  • 2
  • 34
  • 37
  • Thanks a lot for your ideas. Definitely a useful perspective! ;-) – Dr.Kameleon Oct 18 '15 at 13:15
  • One of my main worries (e.g. in your first approach) is how to avoid repetitiveness. I mean... a "word" (which is the word itself plus its attributes - is it a noun? a female noun? perhaps, a verb? is there latin-based transcription? etc...) can be part of lots and lots of different "translation parts". Am I to just re-duplicate it? :S – Dr.Kameleon Oct 18 '15 at 13:19
  • Yes, in that approach you would reduplicate it. Which would mean that in case the word changes, you'd have to reindex all the entries containing that word. – Ashalynd Oct 18 '15 at 14:22