@@ -105,42 +105,46 @@ public async ValueTask StopAsync(Cancel ctx = default)
105105 }
106106
107107 _logger . LogInformation ( "_reindex updates: '{SourceIndex}' => '{DestinationIndex}'" , lexicalWriteAlias , semanticWriteAlias ) ;
108- var request = PostData . Serializable ( new
108+ var request = PostData . String ( @"
109109 {
110- dest = new { index = semanticWriteAlias } ,
111- source = new
112- {
113- index = lexicalWriteAlias ,
114- size = 100 ,
115- query = new
116- {
117- range = new
118- {
119- last_updated = new { gte = _batchIndexDate . ToString ( "o" ) }
110+ ""dest"": {
111+ ""index"": """ + semanticWriteAlias + @"""
112+ },
113+ ""source"": {
114+ ""index"": """ + lexicalWriteAlias + @""",
115+ ""size"": 100,
116+ ""query"": {
117+ ""range"": {
118+ ""last_updated"": {
119+ ""gte"": """ + _batchIndexDate . ToString ( "o" ) + @"""
120+ }
120121 }
121122 }
122123 }
123- } ) ;
124+ }" ) ;
124125 await DoReindex ( request , lexicalWriteAlias , semanticWriteAlias , "updates" , ctx ) ;
125126
126127 _logger . LogInformation ( "_reindex deletions: '{SourceIndex}' => '{DestinationIndex}'" , lexicalWriteAlias , semanticWriteAlias ) ;
127- request = PostData . Serializable ( new
128+ request = PostData . String ( @"
128129 {
129- dest = new { index = semanticWriteAlias } ,
130- script = new { source = "ctx.op = \" delete\" " } ,
131- source = new
132- {
133- index = lexicalWriteAlias ,
134- size = 100 ,
135- query = new
136- {
137- range = new
138- {
139- batch_index_date = new { lt = _batchIndexDate . ToString ( "o" ) }
130+ ""dest"": {
131+ ""index"": """ + semanticWriteAlias + @"""
132+ },
133+ ""script"": {
134+ ""source"": ""ctx.op = \""delete\""""
135+ },
136+ ""source"": {
137+ ""index"": """ + lexicalWriteAlias + @""",
138+ ""size"": 100,
139+ ""query"": {
140+ ""range"": {
141+ ""batch_index_date"": {
142+ ""lt"": """ + _batchIndexDate . ToString ( "o" ) + @"""
143+ }
140144 }
141145 }
142146 }
143- } ) ;
147+ }" ) ;
144148 await DoReindex ( request , lexicalWriteAlias , semanticWriteAlias , "deletions" , ctx ) ;
145149
146150 await DoDeleteByQuery ( lexicalWriteAlias , ctx ) ;
@@ -151,16 +155,16 @@ private async ValueTask DoDeleteByQuery(string lexicalWriteAlias, Cancel ctx)
151155 // delete all documents with batch_index_date < _batchIndexDate
152156 // they weren't part of the current export
153157 _logger . LogInformation ( "Delete data in '{SourceIndex}' not part of batch date: {Date}" , lexicalWriteAlias , _batchIndexDate . ToString ( "o" ) ) ;
154- var request = PostData . Serializable ( new
158+ var request = PostData . String ( @"
155159 {
156- query = new
157- {
158- range = new
159- {
160- batch_index_date = new { lt = _batchIndexDate . ToString ( "o" ) }
160+ "" query"": {
161+ ""range"": {
162+ ""batch_index_date"": {
163+ ""lt"": """ + _batchIndexDate . ToString ( "o" ) + @"""
164+ }
161165 }
162166 }
163- } ) ;
167+ }" ) ;
164168 var reindexUrl = $ "/{ lexicalWriteAlias } /_delete_by_query?wait_for_completion=false";
165169 var deleteOldLexicalDocs = await _transport . PostAsync < DynamicResponse > ( reindexUrl , request , ctx ) ;
166170 var taskId = deleteOldLexicalDocs . Body . Get < string > ( "task" ) ;
0 commit comments