I am new to Elasticsearch(using v 6.3). I am creating a db for my mp3's.
After reading https://www.elastic.co/guide/en/elasticsearch/reference/6.x/removal-of-types.html, I am trying to create a similar mapping for the best results so:
- Data is more likely to be dense and so benefit from compression techniques used in Lucene.
- The term statistics used for scoring in full text search are more likely to be accurate because all documents in the same index represent a single entity.
Here are the mappings:
"mappings": {
"_doc": {
"properties": {
"type": { "type": "keyword" },
"title": { "type": "text" },
"artist": { "type": "text" },
"genre": { "type": "text" },
"track": { "type": "text" },
"date": { "type": "date" },
"filepath": { "type": "text" },
"playlist": { "type": "text" },
"liked": { "type": "boolean" },
"deleted": { "type": "boolean" }
}
}
Later I might do queries based on song title, band , deleted, liked, genre, or play list.
When I insert a song, will I be doing each category(that I would query) in a separate http request with it's type?
For instance.... for song 'take on me' by a-ha, would I do the following?
And what is significance of the url /fragments band-ah-ha and /song-take-on-me?
PUT song/_doc/band-ah-ha
{
"type": "band",
"band": "ah-ha"
}
PUT song/_doc/song-take-on-me
{
"type": "song",
"title": "take on me",
"band": "ah-ha"
}