У меня ниже документ в эластичном формате, и мне нужно получить только разговор, где разговор Id: 3dddf4ab из массива чата, но я получаю весь документ
Документ в эластичном:
{
"_index" : "myindex",
"_type" : "_doc",
"_id" : "1",
"_version" : 1,
"_seq_no" : 0,
"_primary_term" : 1,
"found" : true,
"_source" : {
"chatid" : "1",
"conversations" : [
{
"conversation" : {
"conversationId" : "3dddf4ab",
"startTime" : 1573555131306,
"question" : "abc",
"language" : "English",
"type" : "123",
"answer" : "weeqwew",
"feedback" : {
"rating" : 1,
"endTime" : 0,
"votes" : 1,
"likes" : 1
}
}
},
{
"conversation" : {
"conversationId" : "29363306",
"startTime" : 1567756384492,
"question" : "wer",
"language" : "English",
"type" : "456",
"answer" : "zxsz",
"feedback" : {
"rating" : 0,
"endTime" : 0,
"votes" : 0,
"likes" : 0
}
}
},
{
"conversation" : {
"conversationId" : "3dddf4ab",
"startTime" : 1573555131308,
"question" : "qwer",
"language" : "English",
"type" : "789",
"answer" : "hjhlh",
"feedback" : {
"rating" : 0,
"endTime" : 0,
"votes" : 0,
"likes" : 0
}
}
},
{
"conversation" : {
"conversationId" : "29363306",
"startTime" : 1567756384499,
"question" : "klklkl",
"language" : "English",
"type" : "674",
"answer" : "kjjj;",
"feedback" : {
"rating" : 2,
"endTime" : 0,
"votes" : 4,
"likes" : 4
}
}
}
]
}
}
Поисковый запрос DSL в Kibana:
{
"query": {
"match": {
"chat.conversation.conversationId": {
"query": "3dddf4ab",
"type": "phrase"
}
}
}
}
Ожидается, как показано ниже, но получение всего документа:
Это результат, который я ожидаю, вместо этого я получаю весь документ, включая другие идентификаторы разговоров.
{
"_index": "myindex",
"_type": "_doc",
"_id": "1",
"_version": 1,
"_seq_no": 0,
"_primary_term": 1,
"found": true,
"_source": {
"chatid": "1",
"conversations": [{
"conversation": {
"conversationId": "3dddf4ab",
"startTime": 1573555131306,
"question": "abc",
"language": "English",
"type": "123",
"answer": "weeqwew",
"feedback": {
"rating": 1,
"endTime": 0,
"votes": 1,
"likes": 1
}
}
},
{
"conversation": {
"conversationId": "3dddf4ab",
"startTime": 1573555131308,
"question": "qwer",
"language": "English",
"type": "789",
"answer": "hjhlh",
"feedback": {
"rating": 0,
"endTime": 0,
"votes": 0,
"likes": 0
}
}
}
]
}
}
Отображение индекса
{
"mappings": {
"chatdb": {
"properties": {
"chatid": {
"type": "text"
},
"conversations": {
"type": "nested",
"properties": {
"conversation": {
"type": "object",
"properties": {
"conversationId": {
"type": "text"
},
"startTime": {
"type": "long"
},
"question": {
"type": "text"
},
"language": {
"type": "text"
},
"type": {
"type": "text"
},
"answer": {
"type": "text"
},
"feedback": {
"type": "object",
"properties": {
"rating": {
"type": "float"
},
"endTime": {
"type": "long"
},
"votes": {
"type": "integer"
},
"likes": {
"type": "integer"
}
}
}
}
}
}
}
}
}
}
}
Любая помощь высоко ценится
conversations
совпадает с полемchat
в образцах документов? - person baitmbarek   schedule 13.12.2019