is it possible to create an index with more than one type? Things like this
don't work and thrown a 'Index allready exists':
// create index with more than one type with default mapping
public void createIndex(final String index, final Map<String, Object>
indexSetting, final String... types) throws IndexCreateException
{
final Map<String, Object> indexSettingTmp = indexSetting == null ? new
HashMap<String, Object>() : indexSetting;
final Settings settings = getImmutableSettings(indexSettingTmp);
I don't know the java api, I'm strictly using the REST, but you are calling
create index for every type which of course is giving you "index already
exists"
Have you considered not calling execute() until you've added all the
mappings?
is it possible to create an index with more than one type? Things like
this don't work and thrown a 'Index allready exists':
// create index with more than one type with default mapping
public void createIndex(final String index, final Map<String, Object>
indexSetting, final String... types) throws IndexCreateException
{
final Map<String, Object> indexSettingTmp = indexSetting == null ? new
HashMap<String, Object>() : indexSetting;
final Settings settings = getImmutableSettings(indexSettingTmp);
thats a good hint! I'll try to add .setType() in a for-loop and after this
the execute() will be append. Good idea to create multiple types in one
request. But how can i add further types on existing indexes? Via REST it
seems to be quite simple. But how can I do this via Java API?
Have anybody ideas?
regards,
Alex
Am Freitag, 25. Oktober 2013 19:20:05 UTC+2 schrieb Josh Canfield:
I don't know the java api, I'm strictly using the REST, but you are
calling create index for every type which of course is giving you "index
already exists"
Have you considered not calling execute() until you've added all the
mappings?
On Fri, Oct 25, 2013 at 2:43 AM, Alex <alexand...@gmail.com <javascript:>>wrote:
Hi guys,
is it possible to create an index with more than one type? Things like
this don't work and thrown a 'Index allready exists':
// create index with more than one type with default mapping
public void createIndex(final String index, final Map<String, Object>
indexSetting, final String... types) throws IndexCreateException
{
final Map<String, Object> indexSettingTmp = indexSetting == null ? new
HashMap<String, Object>() : indexSetting;
final Settings settings = getImmutableSettings(indexSettingTmp);
is it possible to to add new type(s) to an existing index via Java API. I
cant find any examples for Java API
Thanks in advance
Alex
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.
I have never created a new type via the Java API, so I can't easily answer
your question, but if you ever need to find the Java equivalent of a REST
call, here are two suggestions:
Look for the Java endpoint of the REST call. It will be in
the org.elasticsearch.rest.action package and will usually have a
recognizable name that begins with Rest, such as RestCreateIndexAction. An
IDE with class name completion helps.
Look at the tests. The majority of elasticsearch tasks are tested via
numerous unit and integration tests. Good place to steal, I mean borrow,
code from.
Give a man a fish, and you feed him for a day; show him how to catch fish,
and you feed him for a lifetime.
thats a good hint! I'll try to add .setType() in a for-loop and after this
the execute() will be append. Good idea to create multiple types in one
request. But how can i add further types on existing indexes? Via REST it
seems to be quite simple. But how can I do this via Java API?
Have anybody ideas?
regards,
Alex
Am Freitag, 25. Oktober 2013 19:20:05 UTC+2 schrieb Josh Canfield:
I don't know the java api, I'm strictly using the REST, but you are
calling create index for every type which of course is giving you "index
already exists"
Have you considered not calling execute() until you've added all the
mappings?
is it possible to create an index with more than one type? Things like
this don't work and thrown a 'Index allready exists':
// create index with more than one type with default mapping
public void createIndex(final String index, final Map<String, Object>
indexSetting, final String... types) throws IndexCreateException
{
final Map<String, Object> indexSettingTmp = indexSetting == null ? new
HashMap<String, Object>() : indexSetting;
final Settings settings = getImmutableSettings(**indexSettingTmp);
for (final String type : types)
{
esClient.admin().indices().prepareCreate(index).
setSettings(settings).**addMapping(type, null).execute().actionGet();
}
}
is it possible to to add new type(s) to an existing index via Java API.
I cant find any examples for Java API
Thanks in advance
Alex
--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearc...@**googlegroups.com.
Many thanks to you Ivan, also for the hint to borro code !
Cheers
Alex
Am Samstag, 26. Oktober 2013 00:22:36 UTC+2 schrieb Ivan Brusic:
I have never created a new type via the Java API, so I can't easily answer
your question, but if you ever need to find the Java equivalent of a REST
call, here are two suggestions:
Look for the Java endpoint of the REST call. It will be in
the org.elasticsearch.rest.action package and will usually have a
recognizable name that begins with Rest, such as RestCreateIndexAction. An
IDE with class name completion helps.
Look at the tests. The majority of elasticsearch tasks are tested via
numerous unit and integration tests. Good place to steal, I mean borrow,
code from.
Give a man a fish, and you feed him for a day; show him how to catch fish,
and you feed him for a lifetime.
Cheers,
Ivan
On Fri, Oct 25, 2013 at 10:41 AM, Alexander Kley <alexand...@gmail.com<javascript:>
wrote:
Hi Josh,
thats a good hint! I'll try to add .setType() in a for-loop and after
this the execute() will be append. Good idea to create multiple types in
one request. But how can i add further types on existing indexes? Via REST
it seems to be quite simple. But how can I do this via Java API?
Have anybody ideas?
regards,
Alex
Am Freitag, 25. Oktober 2013 19:20:05 UTC+2 schrieb Josh Canfield:
I don't know the java api, I'm strictly using the REST, but you are
calling create index for every type which of course is giving you "index
already exists"
Have you considered not calling execute() until you've added all the
mappings?
is it possible to create an index with more than one type? Things like
this don't work and thrown a 'Index allready exists':
// create index with more than one type with default mapping
public void createIndex(final String index, final Map<String, Object>
indexSetting, final String... types) throws IndexCreateException
{
final Map<String, Object> indexSettingTmp = indexSetting == null ?
new HashMap<String, Object>() : indexSetting;
final Settings settings = getImmutableSettings(**indexSettingTmp);
for (final String type : types)
{
esClient.admin().indices().prepareCreate(index).
setSettings(settings).**addMapping(type, null).execute().actionGet();
}
}
is it possible to to add new type(s) to an existing index via Java API.
I cant find any examples for Java API
Thanks in advance
Alex
--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearc...@**googlegroups.com.
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.
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.