I created an index with a mapping, in Java, using the
IndicesAdminClient.create call with a CreateIndexRequest.
I added a large amount of data to my index.
Now I want to alter the mapping: I wish to add some new fields, and I
also want to change the index property of one of the existing fields.
How do I accomplish this in Java? Is there a specific call to update a
mapping, or should I just re-issue the create command with the new
mapping? Will this destroy any of my old data?
I realize that I will need to update all my documents, and I am
prepared to do this, but I do not want to have to remove them all
first.
I created an index with a mapping, in Java, using the
IndicesAdminClient.create call with a CreateIndexRequest.
I added a large amount of data to my index.
Now I want to alter the mapping: I wish to add some new fields, and I
also want to change the index property of one of the existing fields.
How do I accomplish this in Java? Is there a specific call to update a
mapping, or should I just re-issue the create command with the new
mapping? Will this destroy any of my old data?
I realize that I will need to update all my documents, and I am
prepared to do this, but I do not want to have to remove them all
first.
You can add extra fields to an existing mapping, here is the code (you
can set ignore conflicts to true if you want to):
new
PutMappingRequestBuilder(client.admin().indices()).setIgnoreConflicts(true).setIndices(index).setType(type).setSource(mapping).execute().actionGet();
I created an index with a mapping, in Java, using the
IndicesAdminClient.create call with a CreateIndexRequest.
I added a large amount of data to my index.
Now I want to alter the mapping: I wish to add some new fields, and I
also want to change the index property of one of the existing fields.
How do I accomplish this in Java? Is there a specific call to update a
mapping, or should I just re-issue the create command with the new
mapping? Will this destroy any of my old data?
I realize that I will need to update all my documents, and I am
prepared to do this, but I do not want to have to remove them all
first.
Thanks.
--
David Pilatohttp://dev.david.pilato.fr/
Twitter : @dadoonet
The code is complaining if I fail to set the Type. I don't know what
to do:
(1) When I originally created the Index, I did not have to specify a
type.
(2) The "setType" function accepts a string rather than an enum, so I
have no idea what the valid types are or which one I want.
You can add extra fields to an existing mapping, here is the code (you
can set ignore conflicts to true if you want to):
new
PutMappingRequestBuilder(client.admin().indices()).setIgnoreConflicts(true) .setIndices(index).setType(type).setSource(mapping).execute().actionGet();
I created an index with a mapping, in Java, using the
IndicesAdminClient.create call with a CreateIndexRequest.
I added a large amount of data to my index.
Now I want to alter the mapping: I wish to add some new fields, and I
also want to change the index property of one of the existing fields.
How do I accomplish this in Java? Is there a specific call to update a
mapping, or should I just re-issue the create command with the new
mapping? Will this destroy any of my old data?
I realize that I will need to update all my documents, and I am
prepared to do this, but I do not want to have to remove them all
first.
Thanks.
--
David Pilatohttp://dev.david.pilato.fr/
Twitter : @dadoonet
I created an index with a mapping, in Java, using the
IndicesAdminClient.create call with a CreateIndexRequest.
I added a large amount of data to my index.
Now I want to alter the mapping: I wish to add some new fields, and I
also want to change the index property of one of the existing fields.
How do I accomplish this in Java? Is there a specific call to update a
mapping, or should I just re-issue the create command with the new
mapping? Will this destroy any of my old data?
I realize that I will need to update all my documents, and I am
prepared to do this, but I do not want to have to remove them all
first.
Thanks.
--
David Pilatohttp://dev.david.pilato.fr/
Twitter : @dadoonet
Yes but if you want to modify an existing field (e.g. You want to add an analyzer), you won't be able to do it.
But if you only add new fields, it will work.
I created an index with a mapping, in Java, using the
IndicesAdminClient.create call with a CreateIndexRequest.
I added a large amount of data to my index.
Now I want to alter the mapping: I wish to add some new fields, and I
also want to change the index property of one of the existing fields.
How do I accomplish this in Java? Is there a specific call to update a
mapping, or should I just re-issue the create command with the new
mapping? Will this destroy any of my old data?
I realize that I will need to update all my documents, and I am
prepared to do this, but I do not want to have to remove them all
first.
Thanks.
--
David Pilatohttp://dev.david.pilato.fr/
Twitter : @dadoonet
I was able to modify a field and change the index value on a field
from "no" to "not analyzed". At least, the server accepted the request
without throwing any exception. I won't know for sure if it actually
worked.
As an aside, I have a large index that took almost a week to build. It
isn't practical for me to delete it and reindex. I hope that the
developers of Elasticsearch keep people like me in mind as they
develop the product, and do not expect us to simply start over
whenever we want to make changes to our data stores.
Yes but if you want to modify an existing field (e.g. You want to add an analyzer), you won't be able to do it.
But if you only add new fields, it will work.
I created an index with a mapping, in Java, using the
IndicesAdminClient.create call with a CreateIndexRequest.
I added a large amount of data to my index.
Now I want to alter the mapping: I wish to add some new fields, and I
also want to change the index property of one of the existing fields.
How do I accomplish this in Java? Is there a specific call to update a
mapping, or should I just re-issue the create command with the new
mapping? Will this destroy any of my old data?
I realize that I will need to update all my documents, and I am
prepared to do this, but I do not want to have to remove them all
first.
Thanks.
--
David Pilatohttp://dev.david.pilato.fr/
Twitter : @dadoonet
You can verify if you mapping has been updated or not by using get mapping. Some aspects can be changed, but not the "index" aspect of a field.
On Thursday, February 2, 2012 at 7:08 PM, Frank LaRosa wrote:
I was able to modify a field and change the index value on a field
from "no" to "not analyzed". At least, the server accepted the request
without throwing any exception. I won't know for sure if it actually
worked.
As an aside, I have a large index that took almost a week to build. It
isn't practical for me to delete it and reindex. I hope that the
developers of Elasticsearch keep people like me in mind as they
develop the product, and do not expect us to simply start over
whenever we want to make changes to our data stores.
Yes but if you want to modify an existing field (e.g. You want to add an analyzer), you won't be able to do it.
But if you only add new fields, it will work.
I created an index with a mapping, in Java, using the
IndicesAdminClient.create call with a CreateIndexRequest.
I added a large amount of data to my index.
Now I want to alter the mapping: I wish to add some new fields, and I
also want to change the index property of one of the existing fields.
How do I accomplish this in Java? Is there a specific call to update a
mapping, or should I just re-issue the create command with the new
mapping? Will this destroy any of my old data?
I realize that I will need to update all my documents, and I am
prepared to do this, but I do not want to have to remove them all
first.
Thanks.
--
David Pilatohttp://dev.david.pilato.fr/
Twitter : @dadoonet
Can you tell me how to do ignore_conflicts without using java api?
Also any insight on what will happen if I make ignore_conflicts:true?
For example: will my mapping have the same field name with two
different types if I change the type of one of my field? Also if now my data
have that field, then what type(out of those 2) will ES use to index the
new data?
Thanks in advance..!!!
ankit
On Wednesday, February 1, 2012 2:44:46 PM UTC-8, Ali Loghmani wrote:
You can add extra fields to an existing mapping, here is the code (you
can set ignore conflicts to true if you want to):
new
PutMappingRequestBuilder(client.admin().indices()).setIgnoreConflicts(true).setIndices(index).setType(type).setSource(mapping).execute().actionGet();
I created an index with a mapping, in Java, using the
IndicesAdminClient.create call with a CreateIndexRequest.
I added a large amount of data to my index.
Now I want to alter the mapping: I wish to add some new fields, and I
also want to change the index property of one of the existing fields.
How do I accomplish this in Java? Is there a specific call to update a
mapping, or should I just re-issue the create command with the new
mapping? Will this destroy any of my old data?
I realize that I will need to update all my documents, and I am
prepared to do this, but I do not want to have to remove them all
first.
Thanks.
--
David Pilatohttp://dev.david.pilato.fr/
Twitter : @dadoonet
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.