Reputation: 77
How do I get the timestamp value? I already set enable and store as true, I can see it on Sense, but was not able to get it.
{
"cubx": {
"mappings": {
"organization": {
"_timestamp": {
"enabled": true,
"store": true
},
"properties": {
"address": {
.
.
.
I can see it...
GET /abc/organization/1234?fields=_timestamp
{
"_index": "abc",
"_type": "organization",
"_id": "1234",
"_version": 1,
"found": true,
"fields": {
"_timestamp": 1430535032967
}
}
But I can't retrieve it...
public GetField getTimestamp(Long companyId) {
GetResponse response = client
.prepareGet(index, type, companyId.toString()).execute()
.actionGet();
return response.getField("_timestamp");
It returns null. I already read a lot of posts here but didn't find an example to get the value to a object. I also tried to use script_value as suggested in this post but without success.
Can someone help me to figure out what I'm doing wrong?
Upvotes: 0
Views: 426
Reputation: 52368
You would need to use it like this GetResponse response = client .prepareGet(index, type, companyId.toString()).setFields("_timestamp").execute() .actionGet();
.
Upvotes: 1