1
Я хотел бы получить координаты из моих данных.Elasticsearch - Доступ к вложенным переменным
"userLoc" : {
"locNm" : "Alexandra Road",
"coordinates" : [
103.8174926,
1.29143
],
Я попробовал следующее, чтобы получить второе значение координат, но это не сработало.
"script": "return _score*doc['userLoc'].coordinates[1];"
Got нижеследующая ошибка.
{
"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[H94j5eYQRXantctqOKMduw][merchantindex][0]: QueryPhaseExecutionException[[merchantindex][0]: query[function score (_all:test,function=script[return _score*doc['userLoc'].coordinates[1];], params [null])],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: GroovyScriptExecutionException[ElasticsearchIllegalArgumentException[No field found for [userLoc] in mapping with types []]]; }{[H94j5eYQRXantctqOKMduw][merchantindex][1]: QueryPhaseExecutionException[[merchantindex][1]: query[function score (_all:test,function=script[return _score*doc['userLoc'].coordinates[1];], params [null])],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: GroovyScriptExecutionException[ElasticsearchIllegalArgumentException[No field found for [userLoc] in mapping with types []]]; }{[H94j5eYQRXantctqOKMduw][merchantindex][2]: QueryPhaseExecutionException[[merchantindex][2]: query[function score (_all:test,function=script[return _score*doc['userLoc'].coordinates[1];], params [null])],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: GroovyScriptExecutionException[ElasticsearchIllegalArgumentException[No field found for [userLoc] in mapping with types []]]; }{[H94j5eYQRXantctqOKMduw][merchantindex][3]: QueryPhaseExecutionException[[merchantindex][3]: query[function score (_all:test,function=script[return _score*doc['userLoc'].coordinates[1];], params [null])],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: GroovyScriptExecutionException[ElasticsearchIllegalArgumentException[No field found for [userLoc] in mapping with types []]]; }{[H94j5eYQRXantctqOKMduw][merchantindex][4]: QueryPhaseExecutionException[[merchantindex][4]: query[function score (_all:test,function=script[return _score*doc['userLoc'].coordinates[1];], params [null])],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: GroovyScriptExecutionException[ElasticsearchIllegalArgumentException[No field found for [userLoc] in mapping with types []]]; }]",
"status": 500
}