相关疑难解决方法(0)

有没有办法在elasticsearch服务器中导入json文件(包含100个文档).

有没有办法在elasticsearch服务器中导入JSON文件(包含100个文档)?我想将一个大的json文件导入es-server ..

json artificial-intelligence bigdata elasticsearch elasticsearch-plugin

32
推荐指数
6
解决办法
5万
查看次数

在 Elasticsearch 中插入多个文档 - 批量文档格式化程序

TLDR;如何批量格式化我的 JSON 文件以摄取到 Elasticsearch?

我正在尝试将一些 NOAA 数据摄取到 Elasticsearch 中,并且一直在使用 NOAA Python SDK

我编写了以下 Python 脚本来加载数据并将其存储为 JSON 格式。

from noaa_sdk import noaa
import json

n = noaa.NOAA()
alerts = n.alerts()
f = open('nhc_alerts.json', 'w')
json.dump(alerts, f)
f.write('\n')
Run Code Online (Sandbox Code Playgroud)

JSON 输出:

{"@context": ["https://raw.githubusercontent.com/geojson/geojson-ld/master/contexts/geojson-base.jsonld", {"wx": "https://api.weather.gov/ontology#", "@vocab": "https://api.weather.gov/ontology#"}], "type": "FeatureCollection", "features": [{"id": "https://api.weather.gov/alerts/NWS-IDP-PROD-KEEPALIVE-5246", "type": "Feature", "geometry": null, "properties": {"@id": "https://api.weather.gov/alerts/NWS-IDP-PROD-KEEPALIVE-5246", "@type": "wx:Alert", "id": "NWS-IDP-PROD-KEEPALIVE-5246", "areaDesc": "Montgomery", "geocode": {"UGC": ["MDC031"], "SAME": ["024031"]}, "affectedZones": ["https://api.weather.gov/zones/county/MDC031"], "references": [], "sent": "2020-04-25T19:21:03+00:00", "effective": "2020-04-25T19:21:03+00:00", "onset": null, "expires": "2020-04-25T19:31:03+00:00", …
Run Code Online (Sandbox Code Playgroud)

python json elasticsearch

2
推荐指数
1
解决办法
1069
查看次数