我有一个通过命令行传递的查询:
aws cloudsearchdomain --endpoint-url http://myendpt search --search-query value --return _all_fields --cursor initial --size 100 --query-options {"defaultOperator":"or","fields":["id"],"operators":["and","escape","fuzzy","near","not","or","phrase","precedence","prefix","whitespace"]} --query-parser simple --query-parser simple --profile myname它的答复是:
Unknown options: operators:[and, escape, fuzzy, near, not, or, phrase, precedence, prefix, whitespace], fields:[id]我向您保证,id字段存在于AWS Cloudsearch中。我将在线云搜索查询测试器中的查询反向设计为AWS。
请帮帮忙。
更新:
此问题已在更新的aws-cli/1.8.4中解决。如果您是像我这样的ubuntu/linux用户:
请做:
sudo pip uninstall awscli
sudo pip install awscli
aws --version发布于 2015-09-09 22:14:33
总结Asker的解决方案,从评论:问题是,您必须双重引用您的json,然后要么单引号(')或转义双引号(\")的json键/值在您的参数。
例如,这两者都是有效的。
--query-options "{'defaultOperator':'and','fields':['name']}"或
--query-options "{\"defaultOperator\":\"and\",\"fields\":[\"name\"]}"发布于 2015-09-10 14:48:41
aws-sdk, ver > 2红宝石实现的解决方案
client = Aws::CloudSearchDomain::Client.new(endpoint:'http://yoururl')
resp = client.search({
cursor:"initial",
facet:"{\"facet_name_!\":{},\"mentions\":{}}",
query:"#{place_a_value_here}",
query_options:"{\"defaultOperator\":\"or\",\"fields\":[\"yourfield\"],\"operators\":[\"and\",\"escape\",\"fuzzy\",\"near\",\"not\",\"or\",\"phrase\",\"precedence\",\"prefix\",\"whitespace\"]}",
query_parser:"simple",
return:"_all_fields",
size:1000,
highlight:"{\"text\":{}}",
})https://stackoverflow.com/questions/32464291
复制相似问题