I have a trouble searching by nested field.
For example my document is:
{
"chat": [
{
"messages": [
{
"id": "61",
"text": "some text here"
},
{
"id": "62",
"text": "some62 text62 here62"
},
{
"id": "63",
"text": "some63 text63 here63"
},
{
"id": "64",
"text": "some64 text64 here64"
}
]
}
]
}
I'm searching through messages.text. If I search
"text": "some"
{
"query" : {
"nested": {
"path": "messages",
"query": {
"bool": {
"must": [{
"match": {
"text": "some"
}
}]
}
}
}
}
}
I want output something like
{
"chat": [
{
"messages": [
{
"id": "61",
"text": "some text here"
}
]
}
]
}
and not the whole document. I suppose I should use nested property, so
messages in chat is mapped as "nested". Please anyone help me.
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/0ade073a-38b1-4384-b56b-623ca92de033%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.