我已经使用流式API从Twitter上获取了一些数据。该文件具有与数据相对应的json行。我想在Elasticsearch中索引此数据,以便可以轻松地对其进行搜索。
我使用以下命令进行索引
cat file.json | jq -c '.[] | {"index": {"_index": "bookmarks", "_type": "bookmark", "_id": .id}}, .' | curl -XPOST localhost:9200/_bulk --data-binary @-
但它导致以下错误。
jq: error (at <stdin>:127687): Cannot index string with string "id"
最佳答案
无需手动完成所有操作,您只需使用Logstash Twitter Input。
我为此写了一个blog post。
关于elasticsearch - 如何在Elasticsearch中索引Twitter数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44917934/