Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I want to use elasticsearch as a web search engine for books. A book has several editions with different titles in different languages, ISBN's as well as author names in different languages. I want that a book is found by any combination of title language and author name language i.e. the Latin name of Aristotle and the english title of one of his works.

How do I store all possible names of the author, all ISBN's, all titles with respective edition-id's of one book and information about the language in order to get the matching title, it's edition-id and its language as a result to a query?

I believe I need to use 'Nested Type', but I am not sure.

Like that I only find the _id of the book, but not more: { _id: 1 _source: { title: [ Odyssey Odyssee Odisea ] isbn10: [ 2080674722 5941453868 2670361734 ] fullname: [ Homer Omero ] } }

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I found out how to do this with the help of this guide: The nested type is right and in my case the only option.

curl -XPUT localhost:9200/readgeek/book/1 -d'
{
  "names": [
    {
      "english": "Omero",
      "german": "Homer"
    }
  ],
  "authorid": "1",
  "ratings": "2589",
  "editions": [
    {
      "title": "Odyssey",
      "languageid": "123",
      "isbn10": "1234567890",
      "isbn13": "1234567890123",
      "ratings": "158"
    },
    {
      "title": "Odisea",
      "languageid": "150",
      "isbn10": "1234568890",
      "isbn13": "1234569890123",
      "ratings": "15"
    },
    {
      ...
    }
  ]
}'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.