i have this mapping on my elasticsearch index:
{
"mappings": {
"properties": {
"title": {
"type": "keyword"
},
"description": {
"type": "text"
},
"content": {
"type": "text"
},
"author": {
"type": "keyword"
},
"completionTimeMinutes": {
"type": "integer"
},
"views": {
"type": "integer"
},
"questions": {
"type": "nested",
"properties": {
"question": {
"type": "keyword"
},
"answers": {
"type": "keyword"
},
"rightAnswer": {
"type": "integer"
}
}
}
}
}
}
And i have some problems with querying from multiple fields. In my case i want to search across title, description, content, questions.question, questions.answer. My query that doesn't work looks like this:
{
"query": {
"bool": {
"must": {
"multi_match": {
"query": "text to search i put here",
"type": "cross_fields",
"fields": [
"title",
"description",
"content",
"questions.question",
"questions.answers"
],
"slop": 1
}
}
}
}
}
I also tried {"query": { "nested": { "path": "questions", ......, where ...... is above query, but if so, i cant search in title, description, content. So please tell me how to query from multiple nested levels.