From e69993188e111fa3c9c5551657a67dbaeaaa2990 Mon Sep 17 00:00:00 2001 From: Pawan Akhil Date: Sun, 28 Mar 2021 17:24:24 +0530 Subject: [PATCH 1/2] Added source field option for CloudSearch define-index-field --- awscli/customizations/cloudsearch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/awscli/customizations/cloudsearch.py b/awscli/customizations/cloudsearch.py index edc4773f2830..f1311d723829 100644 --- a/awscli/customizations/cloudsearch.py +++ b/awscli/customizations/cloudsearch.py @@ -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", From ccbe2a477671585dcb62f75d1b99cfbdc4ac8747 Mon Sep 17 00:00:00 2001 From: Pawan Akhil Date: Sun, 28 Mar 2021 18:36:26 +0530 Subject: [PATCH 2/2] Updated test with Source field field option --- tests/functional/cloudsearch/test_cloudsearch.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/functional/cloudsearch/test_cloudsearch.py b/tests/functional/cloudsearch/test_cloudsearch.py index 8535c2acf5b2..5550c822633d 100644 --- a/tests/functional/cloudsearch/test_cloudsearch.py +++ b/tests/functional/cloudsearch/test_cloudsearch.py @@ -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): @@ -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)