Painless is Painful

Elastic search 5.6 reached its end of life date on Monday. I work on a project that uses Elastic search extensively. The downside is we have recently had a refresh of the development team leaving us with no more than 6 months exposure to a 2 to 4 year old code base.

The first discovery of the upgrade (to 6.6.1) was the new restriction that you need to be explicit about content types. This is not too difficult but does require a few changes.

The second big discovery was the move to not allow multiple types within an index. This can be resolved by adding a type field and using that to discriminate.

The third discovery was `application/x-ndjson` which is used in the bulk update process. This is a content type that takes a list of JSON items each terminated with a newline. This forms an equivalent to a CSV file. For bulk updates you send pair’s of action/metadata followed by a body element with the details.

The fourth discovery is the new language called Painless. This replaces Groovy which we had previously used. Despite various claims it is not a drop-in replacement. It’s a paired down Java with almost no syntactic sugar. Adding arrays – nope, converting to sets or lists, nope. String split requires regex to be enabled (which it advises against). To pass in parameters requires the undocumented params object. There is no cli or compiler to use to test this – just error messages that try to point you in the right direction. The name Painless itself makes it hard to search for. I understand what it is trying to be (efficient and secure) but it comes across as clumsy.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s