I am developping a small library that integrates Morphia (MongoDB) and
ElasticSearch using the ES java API.
During application startup I use Annotated Entities to generate the ES
index Mapping.
Everything works pretty fine and I am able to create the index, then
analyzers and the type mappings properly . Indexing works great too.
However I have noted that when restarting the application and going
through the index mapping generation process again (using putMapping
API) the content of the index gets deleted.
I do perform a check to see if the index already exists to avoid
recreating it, however, in my Library the mappings are automatically
uploaded each time the app starts which maybe is the problem ...
Is it a normal behavior of ES? Is the content wiped away when type
mappings are redefined, even if they are exactly the same as the
prevoius ones?
Is there a way to get existing mappings and compare them to the ones
I'm about to upload to avoid this problem?
I am developping a small library that integrates Morphia (MongoDB) and
Elasticsearch using the ES java API.
During application startup I use Annotated Entities to generate the ES
index Mapping.
Everything works pretty fine and I am able to create the index, then
analyzers and the type mappings properly . Indexing works great too.
However I have noted that when restarting the application and going
through the index mapping generation process again (using putMapping
API) the content of the index gets deleted.
I do perform a check to see if the index already exists to avoid
recreating it, however, in my Library the mappings are automatically
uploaded each time the app starts which maybe is the problem ...
Is it a normal behavior of ES? Is the content wiped away when type
mappings are redefined, even if they are exactly the same as the
prevoius ones?
Is there a way to get existing mappings and compare them to the ones
I'm about to upload to avoid this problem?
I took your code and ran it (on 0.17.9, and master), and it works for me.
Started both a 1 node cluster, and a 2 nodes cluster, and getting the
correct doc count on both cases. Any more data on your usage?
Btw, few notes on elasticsearch usage. You don't have to close an index to
put the mappings. Also, you can provide the mappings on index creation time
(so you remove the need to have the put mapping call). Last, if you want to
make things searchable "right away", you can simply call the refresh API.
On Sat, Oct 22, 2011 at 12:27 AM, Alexandre azlist1@gmail.com wrote:
I just upgraded to 0.17.9 and re-ran the test I gave you... and the
problem was still here for me ...
Then I also modified my program a bit to take some of your comments
into account such as using refresh instead of sleep and NOT taking the
index down before putMapping.
And swoosh!! problem seems to have disappeared ...
I don't know what the source of the problem was but maybe there is a
hidden bug to investigate ...
Anyway thank you very much for your help.
I'll probably be bugging you again soon ...
I just upgraded to 0.17.9 and re-ran the test I gave you... and the
problem was still here for me ...
Then I also modified my program a bit to take some of your comments
into account such as using refresh instead of sleep and NOT taking the
index down before putMapping.
And swoosh!! problem seems to have disappeared ...
I don't know what the source of the problem was but maybe there is a
hidden bug to investigate ...
Anyway thank you very much for your help.
I'll probably be bugging you again soon ...
Ok so first of all here are all the configuration infos I can find in
my GUI :
Next I noticed something strange in my console that occurs when
triggering the createIndex(true) method of the test I gave you.
I don0t if its related to the same problem ...
In the logs I get the following :
Exception caught on netty layer [[id: 0x552297d7, /192.168.0.52:55124
=> /192.168.0.52:9301]]
here is the full log of what happened just when creating the index.
I just tested this again today on a different machine (32bit vista)
with a fresh install of ES 0.17.9 with no configuration changes from
what was downloaded and the weird index wiping still occurred.
When the index is taken down before putMapping (even though its not
necessary), the first putMapping call works fine and documents are
indexed but the seccond putMapping call (with same mapping) wipes
the index.
When the index is NOT taken down both putMapping call work fine and
the documents are still there after both calls.
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.