1

在 Elasticsearch 索引中插入以下文档时:

{
  "id": "122223334444",
  "name": "Mei",
  "url": "mei-2019-tamil",
  "alternate_urls": [
    "mei-2019-tamil",
    "sa-baskaran-aishwarya-rajesh-untitled"
  ],
  "type": "Movie",
  "poster": "ed3e439b-1ac1-45fe-a915-a5dae60257df",
  "poster_url": "//assets.appserver.com/ed3e439b-1ac1-45fe-a915-a5dae60257df",
  "alternate_names": [
    "Mei",
    "SA Baskaran - Aishwarya Rajesh Untitled"
  ],
  "popularity": 0.2,
  "info": {
    "running_time": 0,
    "cpl_types": [
      "teaser",
      "feature"
    ],
    "has_cpls": true,
    "genres": [
      "Drama",
      "Thriller"
    ],
    "international_release_date": null,
    "country_specific_release_dates": {},
    "international_film_status": "CS",
    "country_specific_film_statuses": {
      "IN": "CS",
      "CN": "CS",
      "": "CS",
      "SG": "CS"
    },
    "country_specific_certifications": {},
    "language": "Tamil",
    "synopsis": "A thriller film directed by SA Baskaran, starring Aishwarya Rajesh in the lead role.",
    "schedules": {
      "cities": [],
      "countries": []
    },
    "featured": 0,
    "movie_rating": 0,
    "cast": [
      {
        "id": "05ffe715-db60-4947-a45a-99722537571c",
        "name": "Aishwarya Rajesh",
        "url": "aishwarya-rajesh",
        "role": "Actress",
        "poster": "65ab15b6-d54a-4965-95d5-38a839cee17d",
        "poster_url": "//assets.appserver.com/65ab15b6-d54a-4965-95d5-38a839cee17d",
        "type": "Person"
      }
    ],
    "crew": [
      {
        "id": "d9354648-5f48-4bf0-9a00-3de8c4d7a8d0",
        "name": "SA Baskaran",
        "url": "sa-baskaran",
        "role": "Director",
        "poster": null,
        "poster_url": null,
        "type": "Person"
      }
    ]
  },
  "published": true
}

我收到以下消息:

错误:以 [.] 开头或结尾的对象字段使对象解析不明确:

但是,没有任何价值开始于.

我不知道哪个键导致了这个问题。请帮助我识别并解决此问题。

弹性搜索版本:5.6.14

我正在尝试使用耐嚼的 gem 从 rails 应用程序索引 ES。

4

1 回答 1

1

JSON 的值可以为空。但是如果键是空的,那么 ES 在索引时会抛出一个错误。从 JSON 中删除"":{}并再次索引。

参考:https ://discuss.elastic.co/t/object-field-starting-or-ending-with-a-makes-object-resolution-ambiguous/123351

于 2019-08-13T02:20:24.220 回答