Renaming an index in Elastic (slight hacks)

Sometimes you need to rename an Elasticsearch index—maybe to reuse the name for an alias. Officially, this isn’t supported. But with some manual edits and caution, it can be done. ⚠️ Warning: This is dangerous and unsupported. Back up your data first. Recommended Alternatives Reindex API Snapshot and restore Index split If these don’t work for your case, read on. The Hacky Method Stop the Elasticsearch node. Find the metadata files: ...

March 5, 2021 · 1 min · Michael Bisbjerg

Move WSL to different drive

Windows Subsystem for Linux is awesome, but storing its files on the system drive can be limiting. Here’s how to move WSL distributions to another disk. List Containers wsl --list Sample output: Windows Subsystem for Linux Distributions: ubuntu (Default) docker-desktop-data docker-desktop Move a Container Shut down WSL to avoid issues: wsl --shutdown Export the container: wsl --export ubuntu N:\ubuntu.tar Unregister the container: wsl --unregister ubuntu Re-import to new location: wsl --import ubuntu N:\WSL\ubuntu N:\ubuntu.tar --version 2 (Optional) Delete the exported .tar file after verifying the setup. This approach preserves the distro while allowing full control over its storage location. ...

February 17, 2021 · 1 min · Michael Bisbjerg

Space Engineers 01.172 - API Documentation

For reference, here is a SandCastle-produced help file for Sandbox.Common from Space Engineers 01.172. 👉 Download Documentation.chm Interesting Starting Points Sandbox.ModAPI.IMyGridProgram — All in-game scripts inherit from this interface. This documentation is especially useful when writing programmable block scripts for automation and custom logic in-game.

August 5, 2017 · 1 min · Michael Bisbjerg

Space Engineers, figuring out the API

This is a short note on how we can develop scripts for use in the game Space Engineers. Background A friend suggested Space Engineers to me, so I bought it and after some scavenging, mining and dying—I tried out the Programmable Block. To my surprise, it used C#! There was one caveat though: the documentation was outdated and often unusable. I managed to piece together scripts using various posts on the official wiki, its Action List, and API List, plus some Reddit threads. ...

August 5, 2017 · 2 min · Michael Bisbjerg

Deserializing different types based on properties, with Newtonsoft.Json

Sometimes we’re presented objects in JSON that do not directly map to a strongly typed object. Here’s a simple example: [ { "type": "Car", "wheels": 4, "trunk": true }, { "type": "Bicycle", "wheels": 2, "persons": 1 } ] The goal is to deserialize these into their respective types, Car and Bicycle, both inheriting from a shared base class Vehicle. JsonConverter JsonConverter allows you to customize how JSON is deserialized. Here’s an implementation that checks the type property and instantiates the appropriate object: ...

August 10, 2016 · 2 min · Michael Bisbjerg