@@ -50,6 +50,7 @@ public async Task SyncLookupIndexAsync(string lexicalAlias, Cancel ct)
5050
5151 await DeleteLookupContentsAsync ( ct ) ;
5252 await ReindexToLookupAsync ( lexicalAlias , ct ) ;
53+ await RefreshLookupIndexAsync ( ct ) ;
5354 await ExecutePolicyAsync ( ct ) ;
5455
5556 logger . LogInformation ( "Content date lookup sync complete" ) ;
@@ -88,9 +89,10 @@ private async Task EnsureLookupIndexAsync(Cancel ct)
8889 ct
8990 ) ;
9091 if ( ! response . ApiCallDetails . HasSuccessfulStatusCode )
91- logger . LogWarning ( "Failed to create content date lookup index {Index}: {Info}" , _lookupIndex , response . ApiCallDetails . DebugInformation ) ;
92- else
93- logger . LogInformation ( "Created content date lookup index {Index}" , _lookupIndex ) ;
92+ throw new InvalidOperationException (
93+ $ "Failed to create content date lookup index { _lookupIndex } : { response . ApiCallDetails . DebugInformation } ") ;
94+
95+ logger . LogInformation ( "Created content date lookup index {Index}" , _lookupIndex ) ;
9496 }
9597
9698 private async Task PutEnrichPolicyAsync ( Cancel ct )
@@ -112,9 +114,10 @@ private async Task PutEnrichPolicyAsync(Cancel ct)
112114 ) ;
113115
114116 if ( ! response . ApiCallDetails . HasSuccessfulStatusCode )
115- logger . LogWarning ( "Failed to create enrich policy {Policy}: {Info}" , PolicyName , response . ApiCallDetails . DebugInformation ) ;
116- else
117- logger . LogInformation ( "Created enrich policy {Policy}" , PolicyName ) ;
117+ throw new InvalidOperationException (
118+ $ "Failed to create enrich policy { PolicyName } : { response . ApiCallDetails . DebugInformation } ") ;
119+
120+ logger . LogInformation ( "Created enrich policy {Policy}" , PolicyName ) ;
118121 }
119122
120123 private async Task ExecutePolicyAsync ( Cancel ct )
@@ -126,9 +129,10 @@ private async Task ExecutePolicyAsync(Cancel ct)
126129 ) ;
127130
128131 if ( ! response . ApiCallDetails . HasSuccessfulStatusCode )
129- logger . LogWarning ( "Failed to execute enrich policy {Policy}: {Info}" , PolicyName , response . ApiCallDetails . DebugInformation ) ;
130- else
131- logger . LogInformation ( "Executed enrich policy {Policy}" , PolicyName ) ;
132+ throw new InvalidOperationException (
133+ $ "Failed to execute enrich policy { PolicyName } : { response . ApiCallDetails . DebugInformation } ") ;
134+
135+ logger . LogInformation ( "Executed enrich policy {Policy}" , PolicyName ) ;
132136 }
133137
134138 private async Task PutPipelineAsync ( Cancel ct )
@@ -174,9 +178,24 @@ private async Task PutPipelineAsync(Cancel ct)
174178 ) ;
175179
176180 if ( ! response . ApiCallDetails . HasSuccessfulStatusCode )
177- logger . LogWarning ( "Failed to create pipeline {Pipeline}: {Info}" , PipelineName , response . ApiCallDetails . DebugInformation ) ;
181+ throw new InvalidOperationException (
182+ $ "Failed to create ingest pipeline { PipelineName } : { response . ApiCallDetails . DebugInformation } ") ;
183+
184+ logger . LogInformation ( "Created ingest pipeline {Pipeline}" , PipelineName ) ;
185+ }
186+
187+ private async Task RefreshLookupIndexAsync ( Cancel ct )
188+ {
189+ var response = await operations . WithRetryAsync (
190+ ( ) => transport . PostAsync < StringResponse > ( $ "/{ _lookupIndex } /_refresh", PostData . Empty , ct ) ,
191+ $ "POST { _lookupIndex } /_refresh",
192+ ct
193+ ) ;
194+
195+ if ( ! response . ApiCallDetails . HasSuccessfulStatusCode )
196+ logger . LogWarning ( "Failed to refresh lookup index {Index}: {Info}" , _lookupIndex , response . ApiCallDetails . DebugInformation ) ;
178197 else
179- logger . LogInformation ( "Created ingest pipeline {Pipeline }" , PipelineName ) ;
198+ logger . LogInformation ( "Refreshed lookup index {Index }" , _lookupIndex ) ;
180199 }
181200
182201 private async Task DeleteLookupContentsAsync ( Cancel ct )
0 commit comments