Mapping problem

Hi,

weird behaviour on mapping....

In a JUnit test I create an index like this:

// 1) Create the index
CreateIndexResponse indexResponse = client.admin().indices().create(
createIndexRequest(IDX_NAME)
).actionGet();
assertTrue(indexResponse.acknowledged());

then add a mapping for it like this:

// 2) Create the mapping
// NB. This will fail if no such INDEX exists
PutMappingRequestBuilder mappBuilder = new
PutMappingRequestBuilder(client.admin().indices());
mappBuilder.setSource(mapData);
mappBuilder.setIndices(IDX_NAME);
PutMappingResponse mappResponse = mappBuilder.execute().actionGet();
// Double check
checkMapping(client);
assertTrue(mappResponse.acknowledged());

here is the mapping

// The mapping def
// FIXME: if using "analyzed" instead of "not_analyzed" it doesn't
work...
String mapData = "{ \n" +
" "file" : { \n " +
" "properties" : { \n" +
" "name" : {"type" : "string", "index" :
"not_analyzed", "store" : "yes"} \n" +
" }\n" +
" }\n" +
"}";

What happens is that this only works when using "index" :
"not_analyzed"
I can retrieve the mapping (through the ClusterAdminClient) and see
it's all there.

when using "index" : "not_analyzed" it just won't get the mapping I've
put (although acknowledged() returns true...)
The mapping that is created is this:
MAPPING =========> {"file":{"properties":{"name":
{"type":"string","store":"yes"}}}}

is this a bug a something wrong in my implementation?

ES version: 0.14.2
In general I have default settings for everything but I can post the
whole file if needed.

Thanks
Stelios

Just found in the docs that "index":analyzed is the default.
Tested with ommiting the index definition (so it should use the
default) and the mapping is put correctly.

stelios

On Feb 4, 6:15 pm, stelios stetog...@gmail.com wrote:

Hi,

weird behaviour on mapping....

In a JUnit test I create an index like this:

// 1) Create the index
CreateIndexResponse indexResponse = client.admin().indices().create(
createIndexRequest(IDX_NAME)
).actionGet();
assertTrue(indexResponse.acknowledged());

then add a mapping for it like this:

// 2) Create the mapping
// NB. This will fail if no such INDEX exists
PutMappingRequestBuilder mappBuilder = new
PutMappingRequestBuilder(client.admin().indices());
mappBuilder.setSource(mapData);
mappBuilder.setIndices(IDX_NAME);
PutMappingResponse mappResponse = mappBuilder.execute().actionGet();
// Double check
checkMapping(client);
assertTrue(mappResponse.acknowledged());

here is the mapping

// The mapping def
// FIXME: if using "analyzed" instead of "not_analyzed" it doesn't
work...
String mapData = "{ \n" +
" "file" : { \n " +
" "properties" : { \n" +
" "name" : {"type" : "string", "index" :
"not_analyzed", "store" : "yes"} \n" +
" }\n" +
" }\n" +
"}";

What happens is that this only works when using "index" :
"not_analyzed"
I can retrieve the mapping (through the ClusterAdminClient) and see
it's all there.

when using "index" : "not_analyzed" it just won't get the mapping I've
put (although acknowledged() returns true...)
The mapping that is created is this:
MAPPING =========> {"file":{"properties":{"name":
{"type":"string","store":"yes"}}}}

is this a bug a something wrong in my implementation?

ES version: 0.14.2
In general I have default settings for everything but I can post the
whole file if needed.

Thanks
Stelios

Just a note regarding your usage of the API, nicer to use this:

client.admin().indices().preparePutMapping(...).set(...).execute().actionGet();
On Friday, February 4, 2011 at 7:55 PM, stelios wrote:

Just found in the docs that "index":analyzed is the default.
Tested with ommiting the index definition (so it should use the
default) and the mapping is put correctly.

stelios

On Feb 4, 6:15 pm, stelios stetog...@gmail.com wrote:

Hi,

weird behaviour on mapping....

In a JUnit test I create an index like this:

// 1) Create the index
CreateIndexResponse indexResponse = client.admin().indices().create(
createIndexRequest(IDX_NAME)
).actionGet();
assertTrue(indexResponse.acknowledged());

then add a mapping for it like this:

// 2) Create the mapping
// NB. This will fail if no such INDEX exists
PutMappingRequestBuilder mappBuilder = new
PutMappingRequestBuilder(client.admin().indices());
mappBuilder.setSource(mapData);
mappBuilder.setIndices(IDX_NAME);
PutMappingResponse mappResponse = mappBuilder.execute().actionGet();
// Double check
checkMapping(client);
assertTrue(mappResponse.acknowledged());

here is the mapping

// The mapping def
// FIXME: if using "analyzed" instead of "not_analyzed" it doesn't
work...
String mapData = "{ \n" +
" "file" : { \n " +
" "properties" : { \n" +
" "name" : {"type" : "string", "index" :
"not_analyzed", "store" : "yes"} \n" +
" }\n" +
" }\n" +
"}";

What happens is that this only works when using "index" :
"not_analyzed"
I can retrieve the mapping (through the ClusterAdminClient) and see
it's all there.

when using "index" : "not_analyzed" it just won't get the mapping I've
put (although acknowledged() returns true...)
The mapping that is created is this:
MAPPING =========> {"file":{"properties":{"name":
{"type":"string","store":"yes"}}}}

is this a bug a something wrong in my implementation?

ES version: 0.14.2
In general I have default settings for everything but I can post the
whole file if needed.

Thanks
Stelios