Hi Shay,
Is there's a way with the Java client API to create a template and set the
source like that :
PutIndexTemplateResponse response = client.admin().indices()
.preparePutTemplate("twitter_template").
.setSource(sourceTemplate)
.execute()
.actionGet();
where source is a json object like :
{
"template" : "te*",
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"_source" : { "enabled" : false }
}
}
}
instead to set setting, mappings ... like that :
PutIndexTemplateResponse response = client.admin().indices()
.preparePutTemplate("twitter_template")
.setTemplate("twitter*")
.addMapping("tweet", sourceMapping)
.setSettings(sourceSettings)
.execute()
.actionGet();
Thank you in advance for your response
kimchy
(Shay Banon)
April 13, 2012, 12:28pm
2
No, there isn't a way to do it, but we can support it if needed (thats what
the REST endpoint does).
On Thu, Apr 12, 2012 at 7:30 PM, Nicolas Huray nicolas.huray@gmail.com wrote:
Hi Shay,
Is there's a way with the Java client API to create a template and set the
source like that :
PutIndexTemplateResponse response = client.admin().indices()
.preparePutTemplate("twitter_template").
.setSource(sourceTemplate)
.execute()
.actionGet();
where source is a json object like :
{
"template" : "te*",
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"_source" : { "enabled" : false }
}
}
}
instead to set setting, mappings ... like that :
PutIndexTemplateResponse response = client.admin().indices()
.preparePutTemplate("twitter_template")
.setTemplate("twitter*")
.addMapping("tweet", sourceMapping)
.setSettings(sourceSettings)
.execute()
.actionGet();
Thank you in advance for your response
Hi Shay,
Thank you for your response. I think I'll submit you a pull request if I
had a little time for that.
Le vendredi 13 avril 2012 14:28:14 UTC+2, kimchy a écrit :
No, there isn't a way to do it, but we can support it if needed (thats
what the REST endpoint does).
On Thu, Apr 12, 2012 at 7:30 PM, Nicolas Huray nicolas.huray@gmail.com wrote:
Hi Shay,
Is there's a way with the Java client API to create a template and set
the source like that :
PutIndexTemplateResponse response = client.admin().indices()
.preparePutTemplate("twitter_template").
.setSource(sourceTemplate)
.execute()
.actionGet();
where source is a json object like :
{
"template" : "te*",
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"_source" : { "enabled" : false }
}
}
}
instead to set setting, mappings ... like that :
PutIndexTemplateResponse response = client.admin().indices()
.preparePutTemplate("twitter_template")
.setTemplate("twitter*")
.addMapping("tweet", sourceMapping)
.setSettings(sourceSettings)
.execute()
.actionGet();
Thank you in advance for your response
kimchy
(Shay Banon)
April 14, 2012, 5:19pm
4
Can you open an issue just in case? We basically need to move the parsing
logic from the rest put index template method into a "setSource" method on
the PutIndexTemplateRequest.
On Sat, Apr 14, 2012 at 1:47 AM, Nicolas Huray nicolas.huray@gmail.com wrote:
Hi Shay,
Thank you for your response. I think I'll submit you a pull request if I
had a little time for that.
Le vendredi 13 avril 2012 14:28:14 UTC+2, kimchy a écrit :
No, there isn't a way to do it, but we can support it if needed (thats
what the REST endpoint does).
On Thu, Apr 12, 2012 at 7:30 PM, Nicolas Huray nicolas.huray@gmail.com wrote:
Hi Shay,
Is there's a way with the Java client API to create a template and set
the source like that :
PutIndexTemplateResponse response = client.admin().indices()
.preparePutTemplate("twitter_**template").
.setSource(sourceTemplate)
.execute()
.actionGet();
where source is a json object like :
{
"template" : "te*",
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"_source" : { "enabled" : false }
}
}
}
instead to set setting, mappings ... like that :
PutIndexTemplateResponse response = client.admin().indices()
.preparePutTemplate("twitter_*template")
.setTemplate("twitter ")
.addMapping("tweet", sourceMapping)
.setSettings(sourceSettings)
.execute()
.actionGet();
Thank you in advance for your response
Hi Shay,
I've just submit you a pull request to fix this issue :
elastic:master
← nhuray:template
opened 10:57AM - 15 Apr 12 UTC
Hi Shay,
This is a pull request to fix issue #1860 regarding the template API.
…
Cheers,
Nicolas
Regards,
Le samedi 14 avril 2012 19:19:22 UTC+2, kimchy a écrit :
Can you open an issue just in case? We basically need to move the parsing
logic from the rest put index template method into a "setSource" method on
the PutIndexTemplateRequest.
On Sat, Apr 14, 2012 at 1:47 AM, Nicolas Huray nicolas.huray@gmail.com wrote:
Hi Shay,
Thank you for your response. I think I'll submit you a pull request if I
had a little time for that.
Le vendredi 13 avril 2012 14:28:14 UTC+2, kimchy a écrit :
No, there isn't a way to do it, but we can support it if needed (thats
what the REST endpoint does).
On Thu, Apr 12, 2012 at 7:30 PM, Nicolas Huray nicolas.huray@gmail.com wrote:
Hi Shay,
Is there's a way with the Java client API to create a template and set
the source like that :
PutIndexTemplateResponse response = client.admin().indices()
.preparePutTemplate("twitter_**template").
.setSource(sourceTemplate)
.execute()
.actionGet();
where source is a json object like :
{
"template" : "te*",
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"_source" : { "enabled" : false }
}
}
}
instead to set setting, mappings ... like that :
PutIndexTemplateResponse response = client.admin().indices()
.preparePutTemplate("twitter_*template")
.setTemplate("twitter ")
.addMapping("tweet", sourceMapping)
.setSettings(sourceSettings)
.execute()
.actionGet();
Thank you in advance for your response
thaidoan
(thaidoan)
May 1, 2012, 2:00pm
6
Hi Shay,
Was the issue fixed in the latest version (0.19.3), yet?
Regards, Thai