Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing index names dynamically with nonlowercase fields causes error #446

Closed
rbraley opened this issue May 4, 2015 · 6 comments
Closed

Comments

@rbraley
Copy link

rbraley commented May 4, 2015

rdd.saveToES("index_{camelCaseField}")

yields the following error:
org.elasticsearch.hadoop.EsHadoopIllegalArgumentException: Invalid index [index_{camelCaseField}] - needs to be lowercase

The field in my documents is not lowercase and cannot be changed. I "fixed" this by removing
+// Assert.isTrue(StringUtils.isLowerCase(index), String.format("Invalid index [%s] - needs to be lowercase", index));
in mr/src/main/java/org/elasticsearch/hadoop/rest/Resource.java
it has been working for me and it seems an unnecessary restriction on the source json documents anyhow.

I would like a more long term solution than forking elasticsearch-hadoop :)

@Highbrainer
Copy link

Hi,

any comment on this? Is this really an unncessary restriction or is there an hidden reason for that?

Thanks in advance!

@costin
Copy link
Member

costin commented Jun 21, 2015

@rbraley @Highbrainer Maybe I'm missing something here but Elasticsearch doesn't allow indexes with uppercase.
Ignore es-hadoop and try:

curl -XPUT 'http://localhost:9200/index_Foo'
[2015-06-21 23:54:40,571][DEBUG][action.admin.indices.create] [Lady Killer] [index_Foo] failed to create
org.elasticsearch.indices.InvalidIndexNameException: [index_Foo] Invalid index name [index_Foo], must be lowercase

the connector does early validation so one doesn't start a job only to have things failing...

Unless I'm missing something, I'm closing this down as won't fix. If you think this isn't the case, please comment.

@Highbrainer
Copy link

@costin : My bad - my problem is with non lowercase Fields as stated in the title - eventhough @rbraley 's text deals with index names...

Something like

PUT localhost:9200/myindex/mytype/123 -d '{"fieldWithUpperCase" : "some value"}'

@costin
Copy link
Member

costin commented Jun 22, 2015

@Highbrainer Have you tried using uppercase/camelcase fields and have ran into an error? If so, please open a new issue. This is supported and tested and part of the test suite.

@costin
Copy link
Member

costin commented Jun 22, 2015

I think I finally understand what the issue is about - the field name is camelcase and is used dynamically but the value is not. I'll submit a fix shortly.

@costin costin closed this as completed Jun 22, 2015
@costin costin reopened this Jun 22, 2015
@costin costin closed this as completed in 6254525 Jun 22, 2015
costin added a commit that referenced this issue Jun 22, 2015
@rbraley
Copy link
Author

rbraley commented Jan 28, 2016

Hi costin this fix only works if there is a single { } pattern in the index portion. if we have an index_{fieldOne}_{fieldTwo} it will error out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants