Indexing Attachment file to elastic search

后端 未结 4 753
暖寄归人
暖寄归人 2021-01-06 15:03

I have typed this command to index a document in Elasticsearch

create an index

curl -X PUT \"localhost:9200/test_idx_1x\"

4条回答
  •  走了就别回头了
    2021-01-06 15:27

    This is a complete shell script implementation:

    file_path='/path/to/file'
    file=$(base64 $file_path | perl -pe 's/\n/\\n/g')
    curl -XPUT "http://eshost.com:9200/index/type/" -d '{
        "file" : "content" : "'$file'"
    }'
    

提交回复
热议问题