Thanks for the solution. I would definitely be using this method were
it not for a rather difficult limitation.
Unfortunately without having at least some redundancy I can't do this
as I need to be able to return the document straight from a search
result without the overhead of parsing it.
Is there no mapping setup that would allow me to simply set the
indexing of the field to a string and have the structure processed the
same was as if it were double encoded as you demonstrate in your gist?
On Jan 18, 4:10 am, Clinton Gormley cl...@traveljury.com wrote:
On Tue, 2012-01-17 at 19:18 -0800, marcuslongmuir wrote:
This is the functionality I would like to achieve, but without
explicitly setting theJSONstructure as astringin the document. I
tried setting the mapping type to "String", but I was unable to search
on the field.
The mapping type should be 'string', not 'String'.
Here is an example:https://gist.github.com/1630868
I index a doc which contains aJSONencodedstring(so in the curl
statement, thatstringis double-encoded).
This automatically creates the 'json' field and sets its type to
'string', and analyzes its contents with the default analyzer.
Then I demonstrate a search on the contents of theJSON, and finally
show all the terms stored in the 'json' field, indicating how thestring
has been analyzed.