How to get all field values of a document which has been set during GetResponse


(bagui) #1

Hi,

I'm to trying to get the filed values of a document which is already been
set. But I have to pass the field name while doing so.
In method call I may not know the fields whatever some one has already set.
Can I get all the fileds from GetField without passing the field name ?

public static GetResponse getResponse(Client client)
{
GetResponse response = client.prepareGet("testindex","testtype",
"1")
.setFields("author","title")
.execute().actionGet();
return response;
}
public String getFieldValues()
{
Node node = nodeBuilder().client(true).data(false).node();
Client client = node.client();

GetResponse response = getResponse(client);
Map<String, GetField> respMap = response.getFields();

GetField field = respMap.get("title");
String fields = (String)field.getValue();

client.close();
node.close();

       return fields;

}

Thanks,
Subhadip

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/010791d9-1e92-45a1-8be4-7df588ba9914%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #2

Maybe something like this?

  for(String key: respMap.keySet()){
    GetField field = respMap.get(key);
  }

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/07adc3b5-de26-46fe-85c4-718f1c5d18cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3