I’ve seen that Solr will allow you to index JSON:
http://wiki.apache.org/solr/UpdateJSON
However, none of the examples are nested. Can you index something like this and if not how is it normally handled?
{
name: 'ben',
state: 'california',
country: 'united states',
companies: [
{
name: 'google',
title: 'software engineer',
},
{
name: 'sherwin-williams',
title: 'web developer'
}
],
}
There are a couple ways to go. A json string can be stored explicitly, with serialization handled in the application layer. Elasticsearch uses this approach transparently.
For indexing, you can flatten the data using naming conventions. Mongodb uses such a syntax.
Note in such a case a query like
would match. If the position should matter, a more advanced SpanQuery would have to be used.