Thanks Brian, that makes sense. I'm going for a much more generic attempt
than just 6 defined indexes though - but the base idea should stay the
same.
Mappings not being compatible would be a problem. I think in my case if a
mapping gets changed to be incompatible, I'd probably just throw an
exception and terminate. Maybe with a special run mode to download an
index's source data as json to a file, drop and re-create the index, and
then upload the data again. Obviously that would need to be something run
manually by a user after taking their site down though as it would not work
in production and not really possible to do nicely.
What I'm trying to put together is a full async ORM for elasticsearch that
lets you use elasticsearch as a DB (similar to how you'd use mongodb with
something like morphia). Mostly it's at the experimental stage as I wanted
to learn what you'd need to do to make an ORM for Java, along with learning
Elasticsearch.
It works well for storing/retrieving complex pojos, and for simple queries,
but it's missing useful advanced features like setting fields to use
specific analysis using annotations and that kind of thing which I'm trying
to work out how to add now. It's a pretty fun project so far, and it's
turning into something useful I think.
On Mon, Feb 10, 2014 at 6:22 PM, InquiringMind brian.from.fl@gmail.comwrote:
Ryan,
The retrieve mappings step is not necessary. If it's automated, then it
would also need to handle the situation where the new mappings are not
compatible with the existing mappings. And ES already does that.
Your steps to check for the index and then, only if the index doesn't
exist, create the index and put the mappings is good. I wrote a tool that
does this, and I call it before my bulk-load updates are performed. I can
also use it to update mappings, though I use that only for experimentation
and not much for production. Still, it works well but sometimes I run into
the case where the new mappings aren't compatible and then I learn a new
thing or two!
The template idea is good; I used to use that. But once I figured out the
Java put and get mappings, I don't do that anymore. I have 6 different
indices on my laptop and each has its own unique mapping that is very
different from that of any other index. So a template would be of no use to
me.
I do lock down ES so that an index is never created automatically, nor is
a new field in a new type created automatically; an explicit mapping is
always required. That has really helped me juggle those 6 different indices
and catch field name spelling errors and bad data really quickly.
Hope this helps! Post back if you'd like additional details on the Java
API for putting and updating mappings.
Brian
--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/0x7VcpS9zGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/c511fe05-544d-422e-9f79-e1d3ef924bed%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.
--
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/CADawRD1Px-jK2NO4NtXdD4ahheOR_D_zXdAWLvMxcEAT%3D%3DqnWw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.