Find out how a document has been indexed?


(Nick Hoffman) #1

Hi guys. After several hours of hacking around, I discovered that the
problem I was working on was the result of a string ("1980-01-01") being
parsed and indexed as a date instead of a string.

Is there a way to find out how ES decided to index a document? It'd be very
helpful to be able to see how each field was indexed, where dynamic
templates were applied, etc.


(David Pilato) #2

You can ask ES for the current mapping on a given type.
http://localhost:9200/index/type/_mapping

You can define your own mapping by putting it before indexing your first document.
PUT http://localhost:9200/index/type/_mapping

See http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html

David :wink:
@dadoonet

Le 16 nov. 2011 à 23:56, Nick Hoffman nick@deadorange.com a écrit :

Hi guys. After several hours of hacking around, I discovered that the problem I was working on was the result of a string ("1980-01-01") being parsed and indexed as a date instead of a string.

Is there a way to find out how ES decided to index a document? It'd be very helpful to be able to see how each field was indexed, where dynamic templates were applied, etc.


(Nick Hoffman) #3

Hey David. Thanks for reminding me about that. I knew you could GET the
mapping, but didn't realize that doing so also shows the mapping for fields
created by dynamic templates.

Cheers!


(system) #4