Mapping validation error

Hi all,

I'm running 0.16.2, both client and server. When I start up my app,
connecting to a stand-alone elasticsearch instance, I get an index mapping
validation error:

Caused by: org.elasticsearch.action.ActionRequestValidationException:
Validation Failed: 1: mapping type is missing
at org.elasticsearch.action.Actions.addValidationError(Actions.java:32)
at
org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest.validate(PutMappingRequest.java:80)
at org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:55)
at
org.elasticsearch.client.node.NodeIndicesAdminClient.putMapping(NodeIndicesAdminClient.java:223)
at
org.elasticsearch.client.action.admin.indices.mapping.put.PutMappingRequestBuilder.doExecute(PutMappingRequestBuilder.java:116)
at
org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder.execute(BaseIndicesRequestBuilder.java:52)
at
org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder.execute(BaseIndicesRequestBuilder.java:47)

I think the problem is a dynamic template where I don't specify a field
type.

Now the strange part: None of my unit tests around this code caught the
error, even though I run the exact same put mapping code in the test.

The only difference I can find between the two is that production uses a
regular client node:

    node = nodeBuilder().
            clusterName(clusterName).
            client(true).
            node();
    client = node.client();

while test uses a local node:

    node = NodeBuilder.nodeBuilder()
                      .local(true)
                      .settings(settingsBuilder()
                              .put("gateway", "none")
                              .put("http.enabled", false)
                              .put("path.data",

"target/var/elasticsearch/data")
)
.node();
client = node.client();

Is it possible that the local node bypasses mapping validation somehow? Is
there a way I can catch this in a test without starting up an actual
discoverable elasticsearch instance?

Curtis

In 0.16.2 you have to specify the mapping type when using the putMapping API. There were corner cases when not providing it, so now its required. Just call setType on it.

On Friday, June 24, 2011 at 6:48 PM, Curtis Caravone wrote:

Hi all,

I'm running 0.16.2, both client and server. When I start up my app, connecting to a stand-alone elasticsearch instance, I get an index mapping validation error:

Caused by: org.elasticsearch.action.ActionRequestValidationException: Validation Failed: 1: mapping type is missing
at org.elasticsearch.action.Actions.addValidationError(Actions.java:32)
at org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest.validate(PutMappingRequest.java:80)
at org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:55)
at org.elasticsearch.client.node.NodeIndicesAdminClient.putMapping(NodeIndicesAdminClient.java:223)
at org.elasticsearch.client.action.admin.indices.mapping.put.PutMappingRequestBuilder.doExecute(PutMappingRequestBuilder.java:116)
at org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder.execute(BaseIndicesRequestBuilder.java:52)
at org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder.execute(BaseIndicesRequestBuilder.java:47)

I think the problem is a dynamic template where I don't specify a field type.

Now the strange part: None of my unit tests around this code caught the error, even though I run the exact same put mapping code in the test.

The only difference I can find between the two is that production uses a regular client node:

node = nodeBuilder().
clusterName(clusterName).
client(true).
node();
client = node.client();

while test uses a local node:

node = NodeBuilder.nodeBuilder()
.local(true)
.settings(settingsBuilder()
.put("gateway", "none")
.put("http.enabled", false)
.put("path.data", "target/var/elasticsearch/data")
)
.node();

client = node.client();

Is it possible that the local node bypasses mapping validation somehow? Is there a way I can catch this in a test without starting up an actual discoverable elasticsearch instance?

Curtis

Sorry about that -- user error. My unit test was pulling in the wrong
elasticsearch version. Fixed the version and now the unit tests catch my
mapping error.

thanks!

Curtis

On Fri, Jun 24, 2011 at 8:59 AM, Shay Banon shay.banon@elasticsearch.comwrote:

In 0.16.2 you have to specify the mapping type when using the putMapping
API. There were corner cases when not providing it, so now its required.
Just call setType on it.

On Friday, June 24, 2011 at 6:48 PM, Curtis Caravone wrote:

Hi all,

I'm running 0.16.2, both client and server. When I start up my app,
connecting to a stand-alone elasticsearch instance, I get an index mapping
validation error:

Caused by: org.elasticsearch.action.ActionRequestValidationException:
Validation Failed: 1: mapping type is missing
at org.elasticsearch.action.Actions.addValidationError(Actions.java:32)
at
org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest.validate(PutMappingRequest.java:80)
at org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:55)
at
org.elasticsearch.client.node.NodeIndicesAdminClient.putMapping(NodeIndicesAdminClient.java:223)
at
org.elasticsearch.client.action.admin.indices.mapping.put.PutMappingRequestBuilder.doExecute(PutMappingRequestBuilder.java:116)
at
org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder.execute(BaseIndicesRequestBuilder.java:52)
at
org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder.execute(BaseIndicesRequestBuilder.java:47)

I think the problem is a dynamic template where I don't specify a field
type.

Now the strange part: None of my unit tests around this code caught the
error, even though I run the exact same put mapping code in the test.

The only difference I can find between the two is that production uses a
regular client node:

    node = nodeBuilder().
            clusterName(clusterName).
            client(true).
            node();
    client = node.client();

while test uses a local node:

    node = NodeBuilder.nodeBuilder()
                      .local(true)
                      .settings(settingsBuilder()
                              .put("gateway", "none")
                              .put("http.enabled", false)
                              .put("path.data",

"target/var/elasticsearch/data")
)
.node();
client = node.client();

Is it possible that the local node bypasses mapping validation somehow? Is
there a way I can catch this in a test without starting up an actual
discoverable elasticsearch instance?

Curtis

Ok, got a valid mapping, but now I'm having trouble getting it to work as
expected.

My goal is to create a mapping that indexes only the fields I need to search
on, rather than all fields in the document.

I attempted to do this by creating a dynamic template that sets all fields
to "index": "no", followed by specific mappings for the few fields I want to
index.

Everything works as expected, except that all fields are getting indexed (I
can tell by browsing the Lucene index using luke).

When I comment out the section with the specific field mappings, I do get a
result without any fields indexed (except maybe the _uid field).

Is there a better way to attempt to do this?

Curtis

On Fri, Jun 24, 2011 at 11:14 AM, Curtis Caravone caravone@gmail.comwrote:

Sorry about that -- user error. My unit test was pulling in the wrong
elasticsearch version. Fixed the version and now the unit tests catch my
mapping error.

thanks!

Curtis

On Fri, Jun 24, 2011 at 8:59 AM, Shay Banon shay.banon@elasticsearch.comwrote:

In 0.16.2 you have to specify the mapping type when using the putMapping
API. There were corner cases when not providing it, so now its required.
Just call setType on it.

On Friday, June 24, 2011 at 6:48 PM, Curtis Caravone wrote:

Hi all,

I'm running 0.16.2, both client and server. When I start up my app,
connecting to a stand-alone elasticsearch instance, I get an index mapping
validation error:

Caused by: org.elasticsearch.action.ActionRequestValidationException:
Validation Failed: 1: mapping type is missing
at org.elasticsearch.action.Actions.addValidationError(Actions.java:32)
at
org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest.validate(PutMappingRequest.java:80)
at org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:55)
at
org.elasticsearch.client.node.NodeIndicesAdminClient.putMapping(NodeIndicesAdminClient.java:223)
at
org.elasticsearch.client.action.admin.indices.mapping.put.PutMappingRequestBuilder.doExecute(PutMappingRequestBuilder.java:116)
at
org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder.execute(BaseIndicesRequestBuilder.java:52)
at
org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder.execute(BaseIndicesRequestBuilder.java:47)

I think the problem is a dynamic template where I don't specify a field
type.

Now the strange part: None of my unit tests around this code caught the
error, even though I run the exact same put mapping code in the test.

The only difference I can find between the two is that production uses a
regular client node:

    node = nodeBuilder().
            clusterName(clusterName).
            client(true).
            node();
    client = node.client();

while test uses a local node:

    node = NodeBuilder.nodeBuilder()
                      .local(true)
                      .settings(settingsBuilder()
                              .put("gateway", "none")
                              .put("http.enabled", false)
                              .put("path.data",

"target/var/elasticsearch/data")
)
.node();
client = node.client();

Is it possible that the local node bypasses mapping validation somehow?
Is there a way I can catch this in a test without starting up an actual
discoverable elasticsearch instance?

Curtis