如何将数据批量插入到其中包含单引号的ElasticSearch中?这是我正在尝试做的一个例子。
curl -XPUT 'http://localhost:9200/example1/example2/_bulk' -d'¬
{ "delete" : { "_id" : "1" } } ¬
{ "create" : { "_id" : "1" } } ¬
{ "name" : "John's House" }¬ '
最佳答案
您不能在单引号中嵌入单引号。
但是您可以中断单引号字符串,然后在其中“插入”单引号:
curl -XPUT 'http://localhost:9200/example1/example2/_bulk' -d'¬
{ "delete" : { "_id" : "1" } } ¬
{ "create" : { "_id" : "1" } } ¬
{ "name" : "John'\''s House" }'
^ ^^
| ||
| |└ start new single-quoted string
| └- escaped single quote outside of single-quoted string
└--- close previously started single-quoted string
关于bash - 在ElasticSearch批量上传中,如何插入带有单引号的数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44468496/