File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
stac_fastapi/sfeos_helpers/stac_fastapi/sfeos_helpers/database Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -150,14 +150,15 @@ def remove_commands(commands: ESCommandSet, path: ElasticPath) -> None:
150
150
path (ElasticPath): Path to value to be removed
151
151
152
152
"""
153
+ commands .add (f"def { path .variable_name } ;" )
153
154
if isinstance (path .key , int ):
154
155
commands .add (
155
156
f"if (ctx._source{ path .es_nest } instanceof ArrayList)"
156
- f"{{def { path .variable_name } = ctx._source{ path .es_nest } .remove({ path .es_key } );}} else "
157
+ f"{{{ path .variable_name } = ctx._source{ path .es_nest } .remove({ path .es_key } );}} else "
157
158
)
158
159
159
160
commands .add (
160
- f"def { path .variable_name } = ctx._source{ path .es_nest } .remove('{ path .key } ');"
161
+ f"{ path .variable_name } = ctx._source{ path .es_nest } .remove('{ path .key } ');"
161
162
)
162
163
163
164
@@ -190,11 +191,12 @@ def add_commands(
190
191
if isinstance (path .key , int ):
191
192
commands .add (
192
193
f"if (ctx._source{ path .es_nest } instanceof ArrayList)"
193
- f"{{ctx._source{ path .es_nest } .{ 'add' if operation .op in ['add' , 'move' ] else 'set' } ({ path .es_key } , { value } )}}"
194
- f" else "
194
+ f"{{ctx._source{ path .es_nest } .{ 'add' if operation .op in ['add' , 'move' ] else 'set' } ({ path .es_key } , { value } ); }}"
195
+ f" else ctx._source { path . es_nest } [' { path . es_key } '] = { value } ; "
195
196
)
196
197
197
- commands .add (f"ctx._source{ path .es_path } = { value } ;" )
198
+ else :
199
+ commands .add (f"ctx._source{ path .es_path } = { value } ;" )
198
200
199
201
200
202
def test_commands (
You can’t perform that action at this time.
0 commit comments