Possible to modity mapping after its creation, by disable search on a property?

Hello everyone,

A problem that I'm trying to handler now it's how to update an existing
mapping after its creation (not adding new fields, but more like to
delete/modify existing ones).
Apparently, read from lots of existing posts, it's not possible unless we
reindex the whole data again.

Since we have the possibility of setting "index":"no" to a property during
the creation of a mapping, so that this property won't be searchable.
So I tested the following scripts.

I created a mapping for a type :
PUT test/mytype/_mapping
{
"mytype" : {
"properties" : {
"id": {"type" : "string"},
"name": {"type" : "string"},
"age": {"type" : "integer"},
"message" : {"type" : "string"}
}
}
}

Then I closed the index, and try to modify the mapping by the following
script
PUT test/mytype/_mapping?ignore_conflicts=true
{
"mytype" : {
"properties" : {
"id": {"type" : "string"},
"name": {"type" : "string"},
"age": {"type" : "integer"},
"message" : {"type" : "string","index": "no"}
}
}
}

Since I choose the option to ignore_conflicts=true, no exception is
returned, but in the same time, nothing happened neither on the mapping.

My question is :
Is there any solution, without reindex the whole data, to disable the
search on some existing properties after creation and insertion of a type?

Thank you very much.

Jac

--
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/a0be22b9-ea77-4801-8251-94ca53389e90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

You need to either create a new field (and reindex) or remove the type or better remove the index.
But reindex.

You can use aliases if you want to do that without downtime. I mean create a new index with new mapping. Reindex. Then switch the alias. Drop the old index.

You can also read elasticsearch if you kept the _source field using some scripts and scan and scroll API.

HTH

--
David Pilato | Technical Advocate | elasticsearch.com
david.pilato@elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 7 octobre 2014 à 11:19:38, Yuan LIN (linyuan1021@gmail.com) a écrit:

Hello everyone,

A problem that I'm trying to handler now it's how to update an existing mapping after its creation (not adding new fields, but more like to delete/modify existing ones).
Apparently, read from lots of existing posts, it's not possible unless we reindex the whole data again.

Since we have the possibility of setting "index":"no" to a property during the creation of a mapping, so that this property won't be searchable.
So I tested the following scripts.

I created a mapping for a type :
PUT test/mytype/_mapping
{
"mytype" : {
"properties" : {
"id": {"type" : "string"},
"name": {"type" : "string"},
"age": {"type" : "integer"},
"message" : {"type" : "string"}
}
}
}

Then I closed the index, and try to modify the mapping by the following script
PUT test/mytype/_mapping?ignore_conflicts=true
{
"mytype" : {
"properties" : {
"id": {"type" : "string"},
"name": {"type" : "string"},
"age": {"type" : "integer"},
"message" : {"type" : "string","index": "no"}
}
}
}

Since I choose the option to ignore_conflicts=true, no exception is returned, but in the same time, nothing happened neither on the mapping.

My question is :
Is there any solution, without reindex the whole data, to disable the search on some existing properties after creation and insertion of a type?

Thank you very much.

Jac

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/a0be22b9-ea77-4801-8251-94ca53389e90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/etPan.5433b0da.8138641.7bd4%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/d/optout.

Thank you very much.

在 2014年10月7日星期二UTC+2上午11时23分13秒,David Pilato写道:

You need to either create a new field (and reindex) or remove the type or
better remove the index.
But reindex.

You can use aliases if you want to do that without downtime. I mean create
a new index with new mapping. Reindex. Then switch the alias. Drop the old
index.

You can also read elasticsearch if you kept the _source field using some
scripts and scan and scroll API.

HTH

--
David Pilato | Technical Advocate | elasticsearch.com
http://elasticsearch.com

david....@elasticsearch.com <javascript:>
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr
https://twitter.com/elasticsearchfr | @scrutmydocs
http://twitter.com/scrutmydocs
https://twitter.com/scrutmydocs

Le 7 octobre 2014 à 11:19:38, Yuan LIN (linyu...@gmail.com <javascript:>)
a écrit:

Hello everyone,

A problem that I'm trying to handler now it's how to update an existing
mapping after its creation (not adding new fields, but more like to
delete/modify existing ones).
Apparently, read from lots of existing posts, it's not possible unless we
reindex the whole data again.

Since we have the possibility of setting "index":"no" to a property during
the creation of a mapping, so that this property won't be searchable.
So I tested the following scripts.

I created a mapping for a type :
PUT test/mytype/_mapping
{
"mytype" : {
"properties" : {
"id": {"type" : "string"},
"name": {"type" : "string"},
"age": {"type" : "integer"},
"message" : {"type" : "string"}
}
}
}

Then I closed the index, and try to modify the mapping by the following
script
PUT test/mytype/_mapping?ignore_conflicts=true
{
"mytype" : {
"properties" : {
"id": {"type" : "string"},
"name": {"type" : "string"},
"age": {"type" : "integer"},
"message" : {"type" : "string","index": "no"}
}
}
}

Since I choose the option to ignore_conflicts=true, no exception is
returned, but in the same time, nothing happened neither on the mapping.

My question is :
Is there any solution, without reindex the whole data, to disable the
search on some existing properties after creation and insertion of a type?

Thank you very much.

Jac

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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/a0be22b9-ea77-4801-8251-94ca53389e90%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/a0be22b9-ea77-4801-8251-94ca53389e90%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/82f5f7c5-6596-47de-b16e-3019e545008a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.