我在Elasticsearch中有这样的数据
"id": "edff12sd3" "main_array": [ { "id": "2308", "name": "Grey Area", "location": { "lat": 28.5696577, "lon": 77.3229933 } } , { "id": "2274", "name": "Tribute to The Beatles by Atul Ahuja- Live Music", "location": { "lat": 29.5696577, "lon": 77.3229933 } }
现在我想为位置字段设置geo_point。我已经尝试过这种方式
{ "mappings": { "search_data": { "properties": { "main_array.location": { "type": "geo_point" } } } } }
但这让我出错
"type": "mapper_parsing_exception", "reason": "Field name [main_array.location] cannot contain '.'"
你能帮我吗 谢谢
location是您存储在中的对象的属性main_array,因此请尝试执行以下操作:
location
main_array
{ "mappings": { "search_data": { "properties": { "main_array": { "properties": { "location": { "type": "geo_point" } } } } } } }
请注意,从ES 2.0版本开始,字段名称可能不包含点