środa, 7 września 2016

elasticdiff

Recently I needed to compare two ElasticSearch indices. To be honest I was pretty sure that I'll find something in the Internet. It was a surprise that no such a tool do exist. I thought that this is good time to pay off portion of my debt to open-source :)

Enter ElasticDiff

elasticdiff is a simple project hosted on GitHub which allows you to compare two ES indices without pain. It is early development, so don't expect much, but for simple indices it works pretty well.

Usage is quite trivial:
python3 elasticdiff.py -t docType -i key http://1.2.3.4/index1 http://2.3.4.5/index1



Output was designed to imitate diff command:
only in left: a5
only in left: a1
only in right: a4
only in right: a2
entries for key a3 differ
--- 

+++ 

@@ -1,4 +1,4 @@

 {
   "key": "a3",
-  "value": "DEF"
+  "value": "XYZ"
 }
Summary:
2 entries only in left index
2 entries only in right index
1 common entries
  0 of them are the same
  1 of them differ

Hopefully someone will find this tool useful.

More information available at GitHub page. I'm planning releasing this on PyPi when it gets more mature. I will update this post when this happens.