Modifying Mapping

Ok so based on a previous suggestion I'm creating a JSON document using
grails JSON converter and initially creating a index before indexing
I see that the JSON is formed as I expected and the create request appears
to go fine, I'm not sure exactly how to query the metadata but this would be
good for validation.

The possible problem I'm seeing now is this.
After the creation I send an index request with some data. I see in the logs
a lot of the following messages.

[20:16:27,787][DEBUG][cluster.metadata ] [Blizzard] Index
[inventory]: Update mapping [sale] (dynamic) with source ...

There is a spew of mapping data following this so why is the mapping being
updated? Is it because I'm not including all the default values and or
fields in my initial create?

Thanks

Hi,

On Tue, Jun 22, 2010 at 5:34 AM, Samuel Doyle samueldoyle@gmail.com wrote:

Ok so based on a previous suggestion I'm creating a JSON document using
grails JSON converter and initially creating a index before indexing
I see that the JSON is formed as I expected and the create request appears
to go fine, I'm not sure exactly how to query the metadata but this would be
good for validation.

you can get actual index mappings via REST API. Cluster state gives you
mappings of all indices in cluster:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/admin/cluster/state/
(actually
"mappings" section is empty in the example in current doc). If you are using
master build (you are building 0.9-SNAPSHOT) then there has been added more
convenient mappings API, see:

Also note that the cluster state in 0.8 release provides mappings in encoded
JSON. This has been fixed in master as well.

The possible problem I'm seeing now is this.
After the creation I send an index request with some data. I see in the
logs a lot of the following messages.

[20:16:27,787][DEBUG][cluster.metadata ] [Blizzard] Index
[inventory]: Update mapping [sale] (dynamic) with source ...

There is a spew of mapping data following this so why is the mapping being
updated? Is it because I'm not including all the default values and or
fields in my initial create?

Thanks

Regards,
Lukas

Thanks for the info!

I was aware of the cluster state api but when I looked at the example in the
docs it didn't have the mapping section as you had pointed out.

Do you have an idea why I'm seeing all the dynamic updates happening? I know
it is a debug message but the mapping is changing with my indexing.
I'm assuming this is because the original mapping didn't contain all the
properties per each field that might be necessary?

Thanks.

On Tue, Jun 22, 2010 at 10:50 AM, Samuel Doyle samueldoyle@gmail.comwrote:

Thanks for the info!

I was aware of the cluster state api but when I looked at the example in
the docs it didn't have the mapping section as you had pointed out.

Do you have an idea why I'm seeing all the dynamic updates happening? I
know it is a debug message but the mapping is changing with my indexing.
I'm assuming this is because the original mapping didn't contain all the
properties per each field that might be necessary?

I think it can be the case that your initial mapping did not contain all the
fields that are found in the documents you are indexing later.

Thanks.

Alright so these are default values being added since I am not adding new
fields during indexing.
Perhaps if this is the case than these default fields should be added during
the create index and not just during the index request.

S.D.

On Tue, Jun 22, 2010 at 1:57 AM, Lukáš Vlček lukas.vlcek@gmail.com wrote:

On Tue, Jun 22, 2010 at 10:50 AM, Samuel Doyle samueldoyle@gmail.comwrote:

Thanks for the info!

I was aware of the cluster state api but when I looked at the example in
the docs it didn't have the mapping section as you had pointed out.

Do you have an idea why I'm seeing all the dynamic updates happening? I
know it is a debug message but the mapping is changing with my indexing.
I'm assuming this is because the original mapping didn't contain all the
properties per each field that might be necessary?

I think it can be the case that your initial mapping did not contain all
the fields that are found in the documents you are indexing later.

Thanks.

The mapping update happens, as suggested, when you index a document that has
additional fields that are not mapped, this causes an update to the mapping
definitions.

-shay.banon

On Tue, Jun 22, 2010 at 12:07 PM, Samuel Doyle samueldoyle@gmail.comwrote:

Alright so these are default values being added since I am not adding new
fields during indexing.
Perhaps if this is the case than these default fields should be added
during the create index and not just during the index request.

S.D.

On Tue, Jun 22, 2010 at 1:57 AM, Lukáš Vlček lukas.vlcek@gmail.comwrote:

On Tue, Jun 22, 2010 at 10:50 AM, Samuel Doyle samueldoyle@gmail.comwrote:

Thanks for the info!

I was aware of the cluster state api but when I looked at the example in
the docs it didn't have the mapping section as you had pointed out.

Do you have an idea why I'm seeing all the dynamic updates happening? I
know it is a debug message but the mapping is changing with my indexing.
I'm assuming this is because the original mapping didn't contain all the
properties per each field that might be necessary?

I think it can be the case that your initial mapping did not contain all
the fields that are found in the documents you are indexing later.

Thanks.