aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

Cloudsearch CLI is facing issue to define-index-field for array type source field

Open dubesar opened this issue 3 years ago • 3 comments

Describe the bug

Cloudsearch gives an option to define index-field with an associative source-field, So if we do -

aws cloudsearch define-index-field --domain-name test --name test_actors --type text-array --source-field actors

for a sample imdb dataset it creates a new index field have source field as it is specified. Now it should work with all fields like int, text, latlon, text-array, literals, literal-array etc. But facing issue in array type fields and its giving an error as -

Parameter validation failed:
Unknown parameter in IndexField.TextArrayOptions: "SourceField", must be one of: DefaultValue, SourceFields, ReturnEnabled, HighlightEnabled, AnalysisScheme

But this works fine for non-array fields giving the expected behaviour.

Expected Behavior

The expected behaviour is that after running for eg -

aws cloudsearch define-index-field --domain-name test --name test_actors --type text-array --source-field actors

it should create an index-field of type text-array with source field as specified.

Current Behavior

Currently facing issue for array-type fields stating -

Parameter validation failed:
Unknown parameter in IndexField.TextArrayOptions: "SourceField", must be one of: DefaultValue, SourceFields, ReturnEnabled, HighlightEnabled, AnalysisScheme

Reproduction Steps

Run this command after you have set up a sample domain for imdb dataset or any other set -

aws cloudsearch define-index-field --domain-name <domain-name> --name <index-name> --type text-array --source-field <source-field-name>

Possible Solution

You can refer to

https://github.com/boto/boto/blob/develop/boto/cloudsearch2/domain.py

for better understanding how array type fields have been handled. Also please look into the recent merge into cloudsearch.py file - https://github.com/aws/aws-cli/blob/master/awscli/customizations/cloudsearch.py

Additional Information/Context

Please also improve the test coverage at - https://github.com/aws/aws-cli/blob/master/tests/functional/cloudsearch/test_cloudsearch.py

CLI version used

aws-cli/2.7.15

Environment details (OS name and version, etc.)

AL2 Instance (DevDesktop)

dubesar avatar Jul 15 '22 06:07 dubesar

Hi @dubesar thanks for reaching out. For reference here is the issue and PR related to that recent change you mentioned: https://github.com/aws/aws-cli/issues/6017 and https://github.com/aws/aws-cli/pull/6045.

Just to clarify, which changes are you suggesting should go in https://github.com/aws/aws-cli/blob/master/awscli/customizations/cloudsearch.py ?

Generally the service teams own and maintain their customizations, so we may want to loop in the CloudSearch team regarding changes here.

tim-finnigan avatar Jul 15 '22 18:07 tim-finnigan

Hello @tim-finnigan I am from the Cloudsearch team and we haven't made any changes to the customizations. Can I get to know who had made these changes? Were they from the AWS-CLI team? or some external contributors? And just want to know why it was merged almost after 1 year?

Also to answer your question regarding changes to go in - We need to cover cases for array as currently only non array source-field are working fine.

dubesar avatar Jul 15 '22 19:07 dubesar

Hi @dubesar in my comment above I linked the issue and PR related to that change. Did you look at those? It appears that an external customer requested the feature and then created a PR to implement it.

Do you plan on creating a PR to implement the required changes? Please let us know what you need from the CLI team. We can also use our internal processes for discussing and tracking this.

tim-finnigan avatar Jul 15 '22 20:07 tim-finnigan