如何将数据批量插入到数据中包含单引号的 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
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句