Expanding the mapping adds field definitions to the mapping, but "acknowledged" is false


(Tomislav Poljak) #1

Hi,
when trying to expand mapping by adding a new field definition, mapping
gets updated (I get update_mapping in ES console) and I see new props
when retrieving mapping definition, but mapping update results in
response {"ok":true,"acknowledged":false}

What does it mean to have "ok":true, but "acknowledged":false?

Here are the steps to re-create:

  1. Create index

curl -XPUT 'http://localhost:9200/twitter/'

result: {"ok":true,"acknowledged":true}

  1. Put default mapping

curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d '
{
"tweet" : {
"properties" : {
"message" : {"type" : "string", "store" : "yes"}
}
}
}
'

result: {"ok":true,"acknowledged":true}

3a. Try to expand (first approach)

curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d '
{
"tweet" : {
"properties" : {
"message" : {"type" : "string", "store" : "yes"},
"newfield" : {"type" : "string", "store" : "yes"}
}
}
}
'

result: {"ok":true,"acknowledged":false}

3b. Try to expand (second approach, same steps 1. & 2.)

curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d '
{
"tweet" : {
"properties" : {
"newfield" : {"type" : "string", "store" : "yes"}
}
}
}
'

result: {"ok":true,"acknowledged":false}

In both cases (3a. and 3b.) mapping gets expanded ( update_mapping [tweet] in ES console) and I see a new field definition when retrieving mapping definition by

curl -XGET 'http://localhost:9200/twitter/tweet/_mapping' > mapping.txt

here is the props part of mapping:

"properties":{"message":{"omit_term_freq_and_positions":false,"index_name":"message","index":"analyzed","omit_norms":false,"store":"yes","boost":1.0,"term_vector":"no","type":"string"},"newfield":{"omit_term_freq_and_positions":false,"index_name":"newfield","index":"analyzed","omit_norms":false,"store":"yes","boost":1.0,"term_vector":"no","type":"string"}},

(for some reason I don't get nicely aligned mapping definition any more with 'get mapping')

Question: Am I trying to expand mapping correctly?

If not, what is the right way/syntax to expand mapping to add new field definition?
If yes, why is "acknowledged":false in result: {"ok":true,"acknowledged":false}

(I'm using latest stable release of ElasticSearch version 0.9.0.)

Tomislav


(Shay Banon) #2

Hi,

The acknowledged part means that the updated mapping got updated on all
the different nodes. In general, there is no reason why it won't be updated,
its just a way to "wait" until the mappings gets propagated across the
cluster. There is a timeout, and if the mappings were not acknowledged by
all the current cluster nodes, then acknowledged flag is set to false and a
response is returned.

Most times, the problem is with handling the acknowledgments, then the
mappings not really being propagated through the cluster. I ran your example
with a single node, and got this as well, so I fixed it (there was a problem
with a single node in the cluster).
http://github.com/elasticsearch/elasticsearch/issues/issue/280.

-shay.banon

On Thu, Jul 29, 2010 at 11:45 AM, Tomislav Poljak tpoljak@gmail.com wrote:

Hi,
when trying to expand mapping by adding a new field definition, mapping
gets updated (I get update_mapping in ES console) and I see new props
when retrieving mapping definition, but mapping update results in
response {"ok":true,"acknowledged":false}

What does it mean to have "ok":true, but "acknowledged":false?

Here are the steps to re-create:

  1. Create index

curl -XPUT 'http://localhost:9200/twitter/'

result: {"ok":true,"acknowledged":true}

  1. Put default mapping

curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d '
{
"tweet" : {
"properties" : {
"message" : {"type" : "string", "store" : "yes"}
}
}
}
'

result: {"ok":true,"acknowledged":true}

3a. Try to expand (first approach)

curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d '
{
"tweet" : {
"properties" : {
"message" : {"type" : "string", "store" : "yes"},
"newfield" : {"type" : "string", "store" : "yes"}
}
}
}
'

result: {"ok":true,"acknowledged":false}

3b. Try to expand (second approach, same steps 1. & 2.)

curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d '
{
"tweet" : {
"properties" : {
"newfield" : {"type" : "string", "store" : "yes"}
}
}
}
'

result: {"ok":true,"acknowledged":false}

In both cases (3a. and 3b.) mapping gets expanded ( update_mapping [tweet]
in ES console) and I see a new field definition when retrieving mapping
definition by

curl -XGET 'http://localhost:9200/twitter/tweet/_mapping' > mapping.txt

here is the props part of mapping:

"properties":{"message":{"omit_term_freq_and_positions":false,"index_name":"message","index":"analyzed","omit_norms":false,"store":"yes","boost":1.0,"term_vector":"no","type":"string"},"newfield":{"omit_term_freq_and_positions":false,"index_name":"newfield","index":"analyzed","omit_norms":false,"store":"yes","boost":1.0,"term_vector":"no","type":"string"}},

(for some reason I don't get nicely aligned mapping definition any more
with 'get mapping')

Question: Am I trying to expand mapping correctly?

If not, what is the right way/syntax to expand mapping to add new field
definition?
If yes, why is "acknowledged":false in result:
{"ok":true,"acknowledged":false}

(I'm using latest stable release of ElasticSearch version 0.9.0.)

Tomislav


(system) #3