Unable to view attributes of nested json object


(Neha) #1

Hi,

I have an Object hierarchy like below :
Class Findings {
int ...;
String ...;
ArraList matches ...;
}

Class Matches {
int.. ;
String...;
String ...;
}

i.e. One Finding object can have list of Matches object. Both the object implement serializable.
After creating index for the above structure, when i try to query the data indexed using get() API, I can see the attributes of "Findings" Object correctly , except however the "Matches" reference in that object appears as a Java instance reference and not the actual list of "Matches" with their values.

{
"_index": "test_java",
"_type": "java",
"_id": "AV5wY2dipQ3FPotqiQGr",
"_version": 1,
"_score": 1,
"_source": {
"clientID": "123",
"Matches": [
"com.paasify.java.domain.Matches@4566e5bd"
],
"CriteriaId": 3,
"GroupId": 1
}
}

How can we index such nested objects?


(Alexander Reelsen) #2

As you havent specified any further technical details, the only thing one can extract from this, is that you have to configure your object mapper properly, so it serializes the Matches class properly instead of just using the toString() representation. A look at the documentation of that JSON serialization tool is your next step. All of this happens before any data is actually sent to Elasticsearch.

Hope this helps!

--Alex


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.