// 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());
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.
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.
// 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());
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.
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.
// 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());
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.