Hi All,
I was wandering if anyone could assist me with the following issue.
I have the next mapping:
{
"user": {
"properties": {
"name": {
"type": "string"
},
"events": {
"type": "nested",
"include_in_parent": "true",
"include_in_root": "true",
"properties": {
"event_time": {
"type": "Date"
},
"products": {
"properties": {
"product": {
"type": "string"
}
}
}
}
}
}
}
}
and I'm trying to reach the 'events' array on the native java script, but getting the next error while executing
return doc().get("events").getClass().toString():
error: SearchPhaseExecutionException[Failed to execute phase [query_fetch], total failure; shardFailures {ElasticSearchIllegalArgumentException[No field found for [events] in mapping with types []]}]
my query is :
curl -XPOST 'http://localhost:9200/users_info/_search
{
"query": {
"nested": {
"path": "events",
"query": {
"bool": {
"must": [
{
"term": {
"events.products.product": "2365443"
}
},
{
"range": {
"events.event_time": {
"gte": "2013-05-1"
}
}
},
{
"range": {
"events.event_time": {
"lte": "2013-05-1"
}
}
}
]
}
}
}
},
"script_fields": {
"MessageReverted": {
"script": "revert",
"lang": "native",
"params": {
"startDate": "2013-05-18"
}
}
}
}
I tried about anything but I can't retrieve anything from the doc() value.
Any idea what I'm doing wrong? am I setting the include_in_parent/include_in_root correctly?
I'm able to get to the source().get("events") value though and retrieve all the data I actually need, but I think that it's too expensive on performance, and all the examples I saw used the doc() method so I guess that will be better.
can you please advise?
Thanks in advanced,
Oren