Hi, I'm new to elastic search, I need to log SearchRequest and use them later for testing/analysis purpose, what's the best practice to serialize/deserialize a SearchRequest in Java?
Thanks!
Hi, I'm new to elastic search, I need to log SearchRequest and use them later for testing/analysis purpose, what's the best practice to serialize/deserialize a SearchRequest in Java?
Thanks!
Hey,
can you elaborate a little? In Java you would usually go with the High Level Rest Client to prevent doing all that serialization work yourself and possibly introduce errors. If that is not an option, maybe you can elaborate a little further what you are after.
--Alex
Hi! Thanks for your reply!
I'd like to log the request and will need to use them later for testing/analysis purpose, so I want to serialize the requests to strings and later deserialize them.
Hi! Thanks for your reply!
I'd like to log the request and will need to use them later for testing/analysis purpose, so I want to serialize the requests to strings and later deserialize them.
How about setting the logging, so you log the request and can reuse it from the logs? See Logging | Java REST Client [7.14] | Elastic
Hmm, the doc says enable request tracer log may be expensive, in addition, I want to log the request from the client side instead of in the ES server, I was thinking of some way to just serialize/deserialize the org.elasticsearch.action.search.SearchRequest
object, by looking at the API doc, this class has writeTo(StreamOutput out) and SearchRequest​(StreamInput in) constructor, not sure if these are supposed to be used for my case.
The toString method also seems to write the request in a json like format, I might be able to use that as well, but relying on this implementation detail seems dangerous...
I'm wondering if there is any good practice to do this..
The request tracer referred to above works on the client side, not the ES server.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.