如何向 ElasticSearch 6.x 插入测试数据
如果你只想向 ElasticSearch 6.x 插入一些测试文档,你可以使用此简单命令:
insert_test_data.sh
curl -X POST "localhost:9200/mydocuments/_doc/" -H 'Content-Type: application/json' -d"
{
\"test\" : true,
\"post_date\" : \"$(date -Ins)\"
}"多次运行此命令以插入多个文档!
如果成功,这将输出类似这样的消息
test_data.json
{"_index":"mydocuments","_type":"_doc","_id":"vCxB82kBn2U9QxlET2aG","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1}另请参见官方文档了解索引 API。
Check out similar posts by category:
ElasticSearch
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow