Hi,
Is it possible to obtain the 'field names'[not values] of the indexed
document using java API in elastic search?
Hi,
Is it possible to obtain the 'field names'[not values] of the indexed
document using java API in elastic search?
IMHO
You could get the mapping of your document type.
You can get your document as a Map and find field names as keys
Does it help ?
David
Twitter : @dadoonet / @elasticsearchfr
Le 2 mai 2012 à 11:11, nmz s.namitha.s@gmail.com a écrit :
Hi,
Is it possible to obtain the 'field names'[not values] of the indexed
document using java API in Elasticsearch?
Hi,
Thanks for the reply.
I tried the following code:
ClusterState cs =
client.admin().cluster().prepareState().execute().actionGet().getState();
IndexMetaData imd = cs.getMetaData().index(INDEX_NAME);
MappingMetaData mmd = imd.mapping(DOCUMENT_NAME);
Map<String, Object> source = mmd.sourceAsMap();
source.keySet() -- only has the value 'properties'
source.values() -- has the remaining part of the document mapping.
So do I have to parse the values() and extract the 'field names' or is
there any other way to obtain the it.
Correct me if my approach is wrong.
On May 2, 2:17 pm, David Pilato da...@pilato.fr wrote:
IMHO
You could get the mapping of your document type.
You can get your document as a Map and find field names as keysDoes it help ?
David
Twitter : @dadoonet / @elasticsearchfrLe 2 mai 2012 à 11:11, nmz s.namith...@gmail.com a écrit :
Hi,
Is it possible to obtain the 'field names'[not values] of the indexed
document using java API in Elasticsearch?
You will need to navigate through the map, or parse the source (using
jackson for example) in order to aggregate all the field names.
On Wed, May 2, 2012 at 1:45 PM, nmz s.namitha.s@gmail.com wrote:
Hi,
Thanks for the reply.
I tried the following code:
ClusterState cs =
client.admin().cluster().prepareState().execute().actionGet().getState();
IndexMetaData imd = cs.getMetaData().index(INDEX_NAME);
MappingMetaData mmd = imd.mapping(DOCUMENT_NAME);
Map<String, Object> source = mmd.sourceAsMap();source.keySet() -- only has the value 'properties'
source.values() -- has the remaining part of the document mapping.So do I have to parse the values() and extract the 'field names' or is
there any other way to obtain the it.Correct me if my approach is wrong.
On May 2, 2:17 pm, David Pilato da...@pilato.fr wrote:
IMHO
You could get the mapping of your document type.
You can get your document as a Map and find field names as keysDoes it help ?
David
Twitter : @dadoonet / @elasticsearchfrLe 2 mai 2012 à 11:11, nmz s.namith...@gmail.com a écrit :
Hi,
Is it possible to obtain the 'field names'[not values] of the indexed
document using java API in Elasticsearch?
© 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.