Hi,
Firstly, apologies for a long post without any gist.
I am facing quite a lot of issues while doing script term facets on my
index (nested json structure). But when I tried recreating in a gist,
everything works fine.
For example, the following query:
{
"from": 0,
"size": 0,
"facets": {
"facet_custom": {
"terms": {
"script_field": "source.?authorJsonMetadata.following +
"" + _source.contentAuthorName",
"size": 100
},
"_cache": false
}
}
}
gives the following error on production
{"error":"SearchPhaseExecutionException[Failed to execute phase [query],
total failure; shardFailures
{[Z2lBIB8NRPKnIkgXgK9cPg][lp-192.168.150.15-5444-lp_test-lp_4_5-1][4]:
RemoteTransportException[[dmz14_data_node][inet[/192.168.150.14:9301]][search/phase/query]];
nested:
QueryPhaseExecutionException[[lp-192.168.150.15-5444-lp_test-lp_4_5-1][4]:
query[ConstantScore(NotDeleted(:))],from[0],size[0]: Query Failed [Failed
to execute main query]]; nested: PropertyAccessException[[Error: could not
access: following; in class: java.util.HashMap]\n[Near : {...
?authorJsonMetadata.following + \"_\" + _source.cont ....}]\n
^\n[Line: 1, Column: 29]];
}{[Z2lBIB8NRPKnIkgXgK9cPg][lp-192.168.150.15-5444-lp_test-lp_4_5-1][1]:
RemoteTransportException[[dmz14_data_node][inet[/192.168.150.14:9301]][search/phase/query]];
nested:
QueryPhaseExecutionException[[lp-192.168.150.15-5444-lp_test-lp_4_5-1][1]:
query[ConstantScore(NotDeleted(:))],from[0],size[0]: Query Failed [Failed
to execute main query]]; nested: PropertyAccessException[[Error: could not
access: contentAuthorName; in class:
org.elasticsearch.search.lookup.SourceLookup]\n[Near : {...
source.?authorJsonMetadata.following + \"\" +
source.contentAuthorName ....}]\n
^\n[Line: 1, Column: 47]];
}{[Z2lBIB8NRPKnIkgXgK9cPg][lp-192.168.150.15-5444-lp_test-lp_4_5-1][0]:
RemoteTransportException[[dmz14_data_node][inet[/192.168.150.14:9301]][search/phase/query]];
nested:
QueryPhaseExecutionException[[lp-192.168.150.15-5444-lp_test-lp_4_5-1][0]:
query[ConstantScore(NotDeleted(:))],from[0],size[0]: Query Failed [Failed
to execute main query]]; nested: PropertyAccessException[[Error: could not
access: following; in class: java.util.HashMap]\n[Near : {...
?authorJsonMetadata.following + \"\" + _source.cont ....}]\n
^\n[Line: 1, Column: 29]];
}{[Z2lBIB8NRPKnIkgXgK9cPg][lp-192.168.150.15-5444-lp_test-lp_4_5-1][2]:
RemoteTransportException[[dmz14_data_node][inet[/192.168.150.14:9301]][search/phase/query]];
nested:
QueryPhaseExecutionException[[lp-192.168.150.15-5444-lp_test-lp_4_5-1][2]:
query[ConstantScore(NotDeleted(:))],from[0],size[0]: Query Failed [Failed
to execute main query]]; nested:
}{[Z2lBIB8NRPKnIkgXgK9cPg][lp-192.168.150.15-5444-lp_test-lp_4_5-1][3]:
RemoteTransportException[[dmz14_data_node][inet[/192.168.150.14:9301]][search/phase/query]];
nested:
QueryPhaseExecutionException[[lp-192.168.150.15-5444-lp_test-lp_4_5-1][3]:
query[ConstantScore(NotDeleted(:))],from[0],size[0]: Query Failed [Failed
to execute main query]]; nested: PropertyAccessException[[Error: could not
access: following; in class: java.util.HashMap]\n[Near : {...
_source.?authorJsonMetadata.fo ....}]\n ^\n[Line: 1, Column:
1]]; }]","status":500}
But the query works. It worked when I tried locally on a test environment.
It is something in my production environment that is causing the issues. I
checked the mappings, all are proper. A sample of the mapping ("1" is type
of my documents) -
{
"1": {
"properties": {
"authorJsonMetadata": {
"properties": {
"favourites": {
"type": "string",
"analyzer": "keyword"
},
"followers": {
"type": "string",
"analyzer": "keyword"
},
"following": {
"type": "string",
"analyzer": "keyword"
},
"likes": {
"type": "string"
},
"listed": {
"type": "string",
"analyzer": "keyword"
}
}
},
"contentAuthorName": {
"type": "string",
"analyzer": "keyword"
}
}
}
}
Null values are probably not the problem. I have tried with data like
following :
{
"contentAuthorName": "Any Tickets Now",
"authorJsonMetadata": null
}
and
{
"contentAuthorName": "Any Tickets Now",
"authorJsonMetadata": {
"listed": "5",
"favourites": "0",
"following": "2002",
"followers": "1548"
}
}
and
{
"contentAuthorName": "Any Tickets Now",
"authorJsonMetadata": {
"listed": "5",
"favourites": "0",
"following": null,
"followers": null
}
}
As I told, everything is working fine as I try to reproduce the problem
locally. In what direction do I need to search in the production
environment? Any hint from the exception logs?
Also,
Is there any good documentation on mvel scripts? Other than the official
site (http://mvel.codehaus.org/Language+Guide+for+2.0) ?
Thanks,
-- Sujoy.
--
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.
For more options, visit https://groups.google.com/groups/opt_out.