I haven't managed to twiddle the builder structure such that they take
effect. E.g. message.text is searchable despite not being index,
sequence accepts numbers despite being boolean, and number_of_shards
being set to BOGUS doesn't produce any errors.
I haven't managed to twiddle the builder structure such that they take
effect. E.g. message.text is searchable despite not being index,
sequence accepts numbers despite being boolean, and number_of_shards
being set to BOGUS doesn't produce any errors.
That helped, thanks. After getting the builder stuff working following
the example, I switched over to supplying the settings as a JSON
string with the following command:
CreateIndexResponse createIndexResponse =
client.admin().indices()
.prepareCreate(indexName)
.setSettings(elasticSearchSettings)
.addMapping(elasticSearchType,
elasticSearchMappings)
.execute().actionGet();
where elasticSearchSettings is:
{
"index" : {
"number_of_shards" : 2,
"number_of_replicas" : 1
}
}
and elasticSearchMappings is in the format
{
"" : {
"properties" : {
"<column_name>" : {
"type" : ...
},
...
}
}
I wasn't able to apply settings using a nested Java Map<String,Object>
structure, but I'm happy with supplying the JSON.
I haven't managed to twiddle the builder structure such that they take
effect. E.g. message.text is searchable despite not being index,
sequence accepts numbers despite being boolean, and number_of_shards
being set to BOGUS doesn't produce any errors.
I do have one question though. Is elasticSearchMappings of type Settings?
Ethan
On Thursday, January 12, 2012 8:09:01 PM UTC-5, Lorrin Nelson wrote:
Hi David,
That helped, thanks. After getting the builder stuff working following
the example, I switched over to supplying the settings as a JSON
string with the following command:
CreateIndexResponse createIndexResponse =
client.admin().indices()
.prepareCreate(indexName)
.setSettings(elasticSearchSettings)
.addMapping(elasticSearchType,
elasticSearchMappings)
.execute().actionGet();
where elasticSearchSettings is:
{
"index" : {
"number_of_shards" : 2,
"number_of_replicas" : 1
}
}
and elasticSearchMappings is in the format
{
"" : {
"properties" : {
"<column_name>" : {
"type" : ...
},
...
}
}
I wasn't able to apply settings using a nested Java Map<String,Object>
structure, but I'm happy with supplying the JSON.
-----Message d'origine-----
De : elasti...@googlegroups.com <javascript:>
[mailto:elasti...@googlegroups.com <javascript:>] De la part de
Lorrin Nelson
Envoyé : mercredi 11 janvier 2012 20:00
À : elasticsearch
Objet : How to definemappingsusingJava API
Could someone share a working example ofusingthe Java API to define
typemappings?
I haven't managed to twiddle the builder structure such that they take
effect. E.g. message.text is searchable despite not being index,
sequence accepts numbers despite being boolean, and number_of_shards
being set to BOGUS doesn't produce any errors.
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.