Savio,

You can get it from the SearchHit. For example:

public void *loadFrom*(SearchHit doc)
{
  index = doc.getIndex();
  type = doc.getType();
  id = doc.getId();
  version = doc.getVersion();

  try
  {
    setTTL(extractTTL(doc));
  }
  catch Exception e)
  {
    ttl = null;
  }
}

public static String *extractTTL*(SearchHit doc)
{
  String ttl = null;
  if (doc != null)
  {
    SearchHitField ttlField = doc.field(TTL_FIELD_NAME);
    if (ttlField != null)
    {
      Value ttlValue = new Value(ttlField.value());
      if (ttlValue != null)
        return ttlValue.toRawString();
    }
  }
  return ttl;
}

And you would do something similar for a GetResponse object, too (response 
from a query-by-id).

Hope this helps!

Brian

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/d7388850-8355-408b-81de-8f91a40004fc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to