2017-09-16 7 views
0

우분투에서 AWS CLI를 사용하여 내 AWS Cloudsearch (2013 API) 도메인을 쿼리하려고합니다. 검색이 특정 필드로 제한 될 때 성공적으로 작동하도록 할 수 없었습니다. 다음 쿼리는 :CLI를 사용하는 AWS CloudSearch 요청에서 잘못된 자바 스크립트 개체 오류가 반환됩니다.

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" 

... 다음과 같은 오류 반환 : 나는 위의 쿼리에서 --query-options 매개 변수를 제거하면

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

를, 그것은 작동합니다. 하여 --query-options 매개 변수의 fields 옵션에 대한 AWS CLI docs에서 :

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

AWS CLI 버전 :

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

답변

2

내가 JSON은 큰 따옴표 안에하지와 같은 임베디드 따옴표처럼 문서가 조금 잘못된 생각, 당신은

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

로 작은 따옴표로 교체해야하거나 따옴표를 탈출 할 수

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