aws / aws/aws-cli

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

Open
#7,112 3 comments 0 reactions 0 assignees View on GitHub
bug cloudsearch customization has-pr p2
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

### 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 --name --type text-array --source-field
```

### 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)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.