数组字段中位置字段的geo_point

时间:2016-05-25 12:06:13

标签: php 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
 }
}

现在我想为location字段设置geo_point。我试过这种方式

{
"mappings": {
"search_data": {
  "properties": {
    "main_array.location": {
      "type": "geo_point"
    }
   }
  }
 }
}

但它会引发我的错误

"type": "mapper_parsing_exception",
"reason": "Field name [main_array.location] cannot contain '.'"
你能帮帮我吗?感谢

1 个答案:

答案 0 :(得分:2)

nvm是您在location中存储的对象的属性,请尝试这样:

main_array

请注意,从ES 2.0 field names may not contain dots

开始