I'm fairly new to ES so forgive me if this is a common scenario that I haven't discovered yet.
I've got an index which contains documents and each document can be related to a specific event, so I have a nested event object in each document. Event -> Document is a one-to-many relationship.
When I am displaying a single document, I want to show "More like this" where more-like-this actually represents more documents from the same meeting, by the same author, or on the same topic. Author and Topic work fine, but although mlt_fields accepts "event.title" as a fieldname, it doesn't ever find any documents from the same event.
My mapping:
{
"myindex": {
"mappings": {
"myitem": {
"properties": {
"authors": {
"type": "string",
"analyzer": "keyword"
},
"id": {
"type": "integer"
},
"title": {
"type": "string"
},
"topics": {
"type": "string",
"analyzer": "keyword"
},
"event": {
"type": "nested",
"properties": {
"title": {
"type": "string",
"analyzer": "keyword"
},
...
}
}
}
}
}
}
}
My Query:
GET /myindex/mydoc/7/_mlt?mlt_fields=event.title&min_doc_freq=1&min_term_freq=1&percent_terms_to_match=0
{
"from": 0,
"size": 5
}
My Results:
{
...
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}
I suspect this is a nesting thing, so do I have to create a nested filtered query with "event = my_event" OR more-like-this = "author or topic" ? Or am I just missing something really stupid ?
include_in_parent: true
property to theevent
field to "flatten" the nested data in addition to having a separate document. – likeitlikeit