2017-09-16 13 views
0

UbuntuのAWS CLIを使用してAWS Cloudsearch(2013 API)ドメインのクエリを実行しようとしています。検索が特定のフィールドに限定されている場合、正常に動作するようにはできませんでした。次のクエリ:CLIを使用したAWS CloudSearchリクエストが無効なJavaScriptオブジェクトエラー

aws --profile myprofile cloudsearchdomain search 
    --endpoint-url "https://search-mydomain-abc123xyz.eu-west-1.cloudsearch.amazonaws.com" 
    --query-options {"fields":["my_field"]} 
    --query-parser "simple" 
    --return "my_field" 
    --search-query "foo bar" 

...次のエラーが返されます。

An error occurred (SearchException) when calling the Search operation: q.options contains invalid javascript object

私は上記のクエリから--query-optionsパラメータを削除した場合、それは動作します。私は、JSONは、二重引用符内に埋め込まれ、二重引用符を好きではないようドキュメントは少し誤解を招くと思い

aws-cli/1.11.150 Python/2.7.12 Linux/4.10.0-28-generic botocore/1.7.8

答えて

2

An array of the fields to search when no fields are specified in a search... Valid for: simple , structured , lucene , and dismax

のAWS CLIバージョン:--query-optionsパラメータのfieldsオプションに関するAWS CLI docsからあなたは一重引用符で置き換える必要があります

--query-options "{'fields':['my_field']}" 

または二重引用符をエスケープすることができます

--query-options "{\"fields\":[\"my_field\"]}" 
関連する問題