Skip to content

Commit

Permalink
Merge pull request #6045 from pawanakhil/feature/cloudsearch/define-i…
Browse files Browse the repository at this point in the history
…ndex-field_SourceField_Option

Feature: Added source field option for define-index-field command under CloudSearch
  • Loading branch information
justindho committed Jun 1, 2022
2 parents c71d1df + ccbe2a4 commit dc7c268
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions awscli/customizations/cloudsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def index_hydrate(params, container, cli_type, key, value):
"hydrate": index_hydrate}),
("IntOptions.SortEnabled", {"name": "sort-enabled",
"hydrate": index_hydrate}),
("IntOptions.SourceField", {"name": "source-field",
"type": "string",
"hydrate": index_hydrate }),
("TextOptions.HighlightEnabled", {"name": "highlight-enabled",
"hydrate": index_hydrate}),
("TextOptions.AnalysisScheme", {"name": "analysis-scheme",
Expand Down
7 changes: 5 additions & 2 deletions tests/functional/cloudsearch/test_cloudsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ def test_flattened(self):
cmdline += ' --type int'
cmdline += ' --default-value 10'
cmdline += ' --search-enabled false'
cmdline += ' --source-field fieldname123'
result = {
'DomainName': 'abc123',
'IndexField': {'IndexFieldName': 'foo',
'IndexFieldType': 'int',
'IntOptions': {'DefaultValue': 10,
'SearchEnabled': False}}}
'SearchEnabled': False,
'SourceField': 'fieldname123'}}}
self.assert_params_for_cmd(cmdline, result)

def test_latlon(self):
Expand All @@ -56,11 +58,12 @@ def test_latlon(self):
cmdline += ' --type latlon'
cmdline += ' --default-value 10'
cmdline += ' --search-enabled false'
cmdline += ' --source-field fieldname123'
result = {
'DomainName': 'abc123',
'IndexField': {
'IndexFieldName': 'foo',
'IndexFieldType': 'latlon',
'LatLonOptions': {
'DefaultValue': '10', 'SearchEnabled': False}}}
'DefaultValue': '10', 'SearchEnabled': False, 'SourceField': 'fieldname123'}}}
self.assert_params_for_cmd(cmdline, result)

0 comments on commit dc7c268

Please sign in to comment.