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 elasticsearch+unsubscribe@googlegroups.com .
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 .
Ivan
(Ivan Brusic)
June 26, 2014, 2:44am
2
That feature is currently not supported by Elasticsearch. You would need to
change to parent/child documents in order to get back only the relevant
documents.
--
Ivan
On Tue, Jun 24, 2014 at 10:03 AM, Danylo Vivchar vivchar.danylo@gmail.com
wrote:
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 elasticsearch+unsubscribe@googlegroups.com .
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/0ade073a-38b1-4384-b56b-623ca92de033%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/0ade073a-38b1-4384-b56b-623ca92de033%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout .
--
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 elasticsearch+unsubscribe@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBh57aZbu2%3DxwZDPyR3sQx4Jv9Ny%3DJa3FKd9%3D8pHSRZ-Q%40mail.gmail.com .
For more options, visit https://groups.google.com/d/optout .
thanx, parent/child documents helped 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 elasticsearch+unsubscribe@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4de2deb5-da24-44a6-a1e8-b29e556850f7%40googlegroups.com .
For more options, visit https://groups.google.com/d/optout .