I'm using official Elasticsearch client for Java. It works nice, but unfortunately its objects do not implement Serializable interface. I need to serialize instance of QueryBuilder in particular.
I've discovered two ways of serializing objects using the client. One of them is to use QueryBuilder.writeTo(). The other one is to use:
Strings.toString(queryBuilder.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS))
But I cannot find how to deserialize object in both cases.
Also I'm not sure whether it is a best way of solving the task.