spark 怎么读写 elasticsearch

参考这两篇文章:

https://www.bmc.com/blogs/spark-elasticsearch-hadoop/
https://blog.pythian.com/updating-elasticsearch-indexes-spark/

先在ES创建3个document

[mshuai@node1 ~]$ curl -XPUT --header 'Content-Type: application/json' http://your_ip:your_port/school/doc/1 -d '{
   "school" : "SUSE"
}'
[mshuai@node1 ~]$ curl -XPUT --header 'Content-Type: application/json' http://your_ip:your_port/school/doc/2 -d '{
   "school" : "SCU"
}'
[mshuai@node1 ~]$ curl -XPUT --header 'Content-Type: application/json' http://your_ip:your_port/school/doc/3 -d '{
   "school" : "Harvard"
}'

猜你喜欢

转载自www.cnblogs.com/mashuai-191/p/12162434.html