InvalidIndexNameException must not contain whitespace


(Jack Park) #1

Sent again from my email account: the message I posted online is hung
up in approval even though I registered, and it's followed by two spam
messages. I missed the "subscribe" part after registering.

Running 0.16.2 on win7 conversing through Apache HttpClient.
Can create a new index

Trouble putting a mapping. Mapping string sent as built from XContentFactory is:
'{"email":{"properties":{"from":{"type":"string","store":"yes"},"subject":{"type":"string","store":"yes"},"body":{"type":"string","store":"yes"},"date":{"type":"string","store":"yes"},"tags":{"type":"string","store":"yes"},"id":{"type":"string","store":"yes"},"parentId":{"type":"string","store":"yes"}}}}'

I run the query string through URLEncoder.encode so it looks like this:
topicquests%2Femail%2F_mapping%27+-d+%7B%22email%22%3A%7B%22from%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22subject%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22body%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22date%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22tags%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22id%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22parentId%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%7D%7D

If I don't run it through URLEncode, it still crashes.
What the log shows is this:

DEBUG 2011-06-08 17:59:07,225 [main] - <<
"{"error":"InvalidIndexNameException[[topicquests/email/_mapping' -d
'{"email":{"properties":{"from":{"type":"string","store":"yes"},"subject":{"type":"string","store":"yes"},"body":{"type":"string","store":"yes"},"date":{"type":"string","store":"yes"},"tags":{"type":"string","store":"yes"},"id":{"type":"string","store":"yes"},"parentId":{"type":"string","store":"yes"}}}}']
Invalid index name [topicquests/email/_mapping' -d
'{"email":{"properties":{"from":{"type":"string","store":"yes"},"subject":{"type":"string","store":"yes"},"body":{"type":"string","store":"yes"},"date":{"type":"string","store":"yes"},"tags":{"type":"string","store":"yes"},"id":{"type":"string","store":"yes"},"parentId":{"type":"string","store":"yes"}}}}'],
must not contain whitespace]","status":400}"

What am I missing?
Many thanks.


(Karussell) #2

I think you need to POST the string ...

Why not using the Java API or via a curl script?

On Jun 9, 9:54 pm, Jack Park jackp...@gmail.com wrote:

Sent again from my email account: the message I posted online is hung
up in approval even though I registered, and it's followed by two spam
messages. I missed the "subscribe" part after registering.

Running 0.16.2 on win7 conversing through Apache HttpClient.
Can create a new index

Trouble putting a mapping. Mapping string sent as built from XContentFactory is:
'{"email":{"properties":{"from":{"type":"string","store":"yes"},"subject":{"type":"string","store":"yes"},"body":{"type":"string","store":"yes"},"date":{"type":"string","store":"yes"},"tags":{"type":"string","store":"yes"},"id":{"type":"string","store":"yes"},"parentId":{"type":"string","store":"yes"}}}}'

I run the query string through URLEncoder.encode so it looks like this:
topicquests%2Femail%2F_mapping%27+-d+%7B%22email%22%3A%7B%22from%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22subject%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22body%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22date%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22tags%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22id%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22parentId%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%7D%7D

If I don't run it through URLEncode, it still crashes.
What the log shows is this:

DEBUG 2011-06-08 17:59:07,225 [main] - <<
"{"error":"InvalidIndexNameException[[topicquests/email/_mapping' -d
'{"email":{"properties":{"from":{"type":"string","store":"yes"},"subject":{"type":"string","store":"yes"},"body":{"type":"string","store":"yes"},"date":{"type":"string","store":"yes"},"tags":{"type":"string","store":"yes"},"id":{"type":"string","store":"yes"},"parentId":{"type":"string","store":"yes"}}}}']
Invalid index name [topicquests/email/_mapping' -d
'{"email":{"properties":{"from":{"type":"string","store":"yes"},"subject":{"type":"string","store":"yes"},"body":{"type":"string","store":"yes"},"date":{"type":"string","store":"yes"},"tags":{"type":"string","store":"yes"},"id":{"type":"string","store":"yes"},"parentId":{"type":"string","store":"yes"}}}}'],
must not contain whitespace]","status":400}"

What am I missing?
Many thanks.


(Jack Park) #3

Thanks!
I guess I got confused. the API [1] says this:

curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d ...

and I am using Apache HttpPut for the command.

I just switched to HttpPost for the command: same error.

Did I miss another page that says something else?

(I am doing everything programmatically from a Java program--no
opportunity to hand use curl)

Jack
[1] http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html

On Thu, Jun 9, 2011 at 1:27 PM, Karussell tableyourtime@googlemail.com wrote:

I think you need to POST the string ...

Why not using the Java API or via a curl script?

On Jun 9, 9:54 pm, Jack Park jackp...@gmail.com wrote:

Sent again from my email account: the message I posted online is hung
up in approval even though I registered, and it's followed by two spam
messages. I missed the "subscribe" part after registering.

Running 0.16.2 on win7 conversing through Apache HttpClient.
Can create a new index

Trouble putting a mapping. Mapping string sent as built from XContentFactory is:
'{"email":{"properties":{"from":{"type":"string","store":"yes"},"subject":{"type":"string","store":"yes"},"body":{"type":"string","store":"yes"},"date":{"type":"string","store":"yes"},"tags":{"type":"string","store":"yes"},"id":{"type":"string","store":"yes"},"parentId":{"type":"string","store":"yes"}}}}'

I run the query string through URLEncoder.encode so it looks like this:
topicquests%2Femail%2F_mapping%27+-d+%7B%22email%22%3A%7B%22from%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22subject%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22body%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22date%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22tags%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22id%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22parentId%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%7D%7D

If I don't run it through URLEncode, it still crashes.
What the log shows is this:

DEBUG 2011-06-08 17:59:07,225 [main] - <<
"{"error":"InvalidIndexNameException[[topicquests/email/_mapping' -d
'{"email":{"properties":{"from":{"type":"string","store":"yes"},"subject":{"type":"string","store":"yes"},"body":{"type":"string","store":"yes"},"date":{"type":"string","store":"yes"},"tags":{"type":"string","store":"yes"},"id":{"type":"string","store":"yes"},"parentId":{"type":"string","store":"yes"}}}}']
Invalid index name [topicquests/email/_mapping' -d
'{"email":{"properties":{"from":{"type":"string","store":"yes"},"subject":{"type":"string","store":"yes"},"body":{"type":"string","store":"yes"},"date":{"type":"string","store":"yes"},"tags":{"type":"string","store":"yes"},"id":{"type":"string","store":"yes"},"parentId":{"type":"string","store":"yes"}}}}'],
must not contain whitespace]","status":400}"

What am I missing?
Many thanks.


(Karussell) #4

Hi Jack,

I meant you could use the 'real' Java API without any raw stuff or
Apache libs:

Settings s = ImmutableSettings.settingsBuilder().put("cluster.name",
cluster).build();
TransportClient tmp = new TransportClient(s);
tmp.addTransportAddress(new InetSocketTransportAddress(url, port));

// with the next line you need to create the mapping structure
XContentBuilder b =
JsonXContent.unCachedContentBuilder().field("someField", "value");
// ... and eventually call b.startObject before + b.endObject after
this

client.admin().indices().preparePutMapping("indexName").setSource(b);

On Jun 9, 10:35 pm, Jack Park jackp...@gmail.com wrote:

Thanks!
I guess I got confused. the API [1] says this:

curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping'-d ...

and I am using Apache HttpPut for the command.

I just switched to HttpPost for the command: same error.

Did I miss another page that says something else?

(I am doing everything programmatically from a Java program--no
opportunity to hand use curl)

Jack
[1]http://www.elasticsearch.org/guide/reference/api/admin-indices-put-ma...

On Thu, Jun 9, 2011 at 1:27 PM, Karussell tableyourt...@googlemail.com wrote:

I think you need to POST the string ...

Why not using the Java API or via a curl script?

On Jun 9, 9:54 pm, Jack Park jackp...@gmail.com wrote:

Sent again from my email account: the message I posted online is hung
up in approval even though I registered, and it's followed by two spam
messages. I missed the "subscribe" part after registering.

Running 0.16.2 on win7 conversing through Apache HttpClient.
Can create a new index

Trouble putting a mapping. Mapping string sent as built from XContentFactory is:
'{"email":{"properties":{"from":{"type":"string","store":"yes"},"subject":{"type":"string","store":"yes"},"body":{"type":"string","store":"yes"},"date":{"type":"string","store":"yes"},"tags":{"type":"string","store":"yes"},"id":{"type":"string","store":"yes"},"parentId":{"type":"string","store":"yes"}}}}'

I run the query string through URLEncoder.encode so it looks like this:
topicquests%2Femail%2F_mapping%27+-d+%7B%22email%22%3A%7B%22from%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22subject%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22body%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22date%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22tags%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22id%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%2C%22parentId%22%3A%7B%22type%22%3A%22string%22%2C%22store%22%3A%22yes%22%7D%7D%7D

If I don't run it through URLEncode, it still crashes.
What the log shows is this:

DEBUG 2011-06-08 17:59:07,225 [main] - <<
"{"error":"InvalidIndexNameException[[topicquests/email/_mapping' -d
'{"email":{"properties":{"from":{"type":"string","store":"yes"},"subject":{"type":"string","store":"yes"},"body":{"type":"string","store":"yes"},"date":{"type":"string","store":"yes"},"tags":{"type":"string","store":"yes"},"id":{"type":"string","store":"yes"},"parentId":{"type":"string","store":"yes"}}}}']
Invalid index name [topicquests/email/_mapping' -d
'{"email":{"properties":{"from":{"type":"string","store":"yes"},"subject":{"type":"string","store":"yes"},"body":{"type":"string","store":"yes"},"date":{"type":"string","store":"yes"},"tags":{"type":"string","store":"yes"},"id":{"type":"string","store":"yes"},"parentId":{"type":"string","store":"yes"}}}}'],
must not contain whitespace]","status":400}"

What am I missing?
Many thanks.


(Jack Park) #5

Ok. Failed to discover that option. Trying it now.

with url = "http://localhost" or "/localhost" I see
UnresolvedAddressException
with url = "localhost" or "10.1.10.180" (which is published by ec)
and port = 9200

at: client.addTransportAddress(new InetSocketTransportAddress(url, port));

the system hangs and goes nowhere.

One other point: using the mobz-elasticsearch-head javascript browser,
the index is visible and performing just fine.

Not sure why it's hanging.
One other modest question while we are here: do I need to do
URLencoding when going through this transport mechanism?

Thanks
Jack

On Thu, Jun 9, 2011 at 1:47 PM, Karussell tableyourtime@googlemail.com wrote:

Hi Jack,

I meant you could use the 'real' Java API without any raw stuff or
Apache libs:

Settings s = ImmutableSettings.settingsBuilder().put("cluster.name",
cluster).build();
TransportClient tmp = new TransportClient(s);
tmp.addTransportAddress(new InetSocketTransportAddress(url, port));

// with the next line you need to create the mapping structure
XContentBuilder b =
JsonXContent.unCachedContentBuilder().field("someField", "value");
// ... and eventually call b.startObject before + b.endObject after
this

client.admin().indices().preparePutMapping("indexName").setSource(b);


(Karussell) #6

UnresolvedAddressException

use 9300

if that does not help try using 127.0.0.1

Have a look:

http://www.elasticsearch.org/guide/reference/java-api/

mobz-elasticsearch-head

ah, yes, that was a good idea :slight_smile:

do I need to do URLencoding when going through this transport mechanism?

no, as ES uses json (or a special version of it called smile, thats
why you need the different port 9300 for the java client)

On Jun 9, 11:53 pm, Jack Park jackp...@gmail.com wrote:

Ok. Failed to discover that option. Trying it now.

with url = "http://localhost" or "/localhost" I see
UnresolvedAddressException
with url = "localhost" or "10.1.10.180" (which is published by ec)
and port = 9200

at: client.addTransportAddress(new InetSocketTransportAddress(url, port));

the system hangs and goes nowhere.

One other point: using the mobz-elasticsearch-head javascript browser,
the index is visible and performing just fine.

Not sure why it's hanging.
One other modest question while we are here: do I need to do
URLencoding when going through this transport mechanism?

Thanks
Jack

On Thu, Jun 9, 2011 at 1:47 PM, Karussell tableyourt...@googlemail.com wrote:

Hi Jack,

I meant you could use the 'real' Java API without any raw stuff or
Apache libs:

Settings s = ImmutableSettings.settingsBuilder().put("cluster.name",
cluster).build();
TransportClient tmp = new TransportClient(s);
tmp.addTransportAddress(new InetSocketTransportAddress(url, port));

// with the next line you need to create the mapping structure
XContentBuilder b =
JsonXContent.unCachedContentBuilder().field("someField", "value");
// ... and eventually call b.startObject before + b.endObject after
this

client.admin().indices().preparePutMapping("indexName").setSource(b);


(Jack Park) #7

For completeness, the system is now running, thank you very much.

To pull that off, I found it useful to use the web interface after
booting an empty ES database and create the indexes I would use. I
then did not bother injecting schemas but, instead, just indexed
documents as they came in. According to the web interface, all
documents, types, and fields got indexed properly.

Thanks
Jack

On Thu, Jun 9, 2011 at 3:13 PM, Karussell tableyourtime@googlemail.com wrote:

UnresolvedAddressException

use 9300

if that does not help try using 127.0.0.1

Have a look:

http://www.elasticsearch.org/guide/reference/java-api/

mobz-elasticsearch-head

ah, yes, that was a good idea :slight_smile:

do I need to do URLencoding when going through this transport mechanism?

no, as ES uses json (or a special version of it called smile, thats
why you need the different port 9300 for the java client)

On Jun 9, 11:53 pm, Jack Park jackp...@gmail.com wrote:

Ok. Failed to discover that option. Trying it now.

with url = "http://localhost" or "/localhost" I see
UnresolvedAddressException
with url = "localhost" or "10.1.10.180" (which is published by ec)
and port = 9200

at: client.addTransportAddress(new InetSocketTransportAddress(url, port));

the system hangs and goes nowhere.

One other point: using the mobz-elasticsearch-head javascript browser,
the index is visible and performing just fine.

Not sure why it's hanging.
One other modest question while we are here: do I need to do
URLencoding when going through this transport mechanism?

Thanks
Jack

On Thu, Jun 9, 2011 at 1:47 PM, Karussell tableyourt...@googlemail.com wrote:

Hi Jack,

I meant you could use the 'real' Java API without any raw stuff or
Apache libs:

Settings s = ImmutableSettings.settingsBuilder().put("cluster.name",
cluster).build();
TransportClient tmp = new TransportClient(s);
tmp.addTransportAddress(new InetSocketTransportAddress(url, port));

// with the next line you need to create the mapping structure
XContentBuilder b =
JsonXContent.unCachedContentBuilder().field("someField", "value");
// ... and eventually call b.startObject before + b.endObject after
this

client.admin().indices().preparePutMapping("indexName").setSource(b);


(Karussell) #8

On Jun 10, 2:20 am, Jack Park jackp...@gmail.com wrote:

For completeness, the system is now running, thank you very much.

Good. Glad to helped a bit :slight_smile:

To pull that off, I found it useful to use the web interface after
booting an empty ES database and create the indexes I would use. I
then did not bother injecting schemas but, instead, just indexed
documents as they came in. According to the web interface, all
documents, types, and fields got indexed properly.

I'm storing the mapping under e.g. elasticsearch/config/mappings/
_default/tweet.json this way I can add not_analyzed to the fields and
exclude the _all field which is enabled by default:

{
"tweet" : {
"_all" : {"enabled" : false},
"properties" : {
"text" : { "type" : "string", "analyzer" :
"index_analyzer"},
"inreply_l" : { "type" : "long", "null_value" : -1,
"index" : "not_analyzed"},
"user" : { "type" : "string", "index" : "not_analyzed"},
"geo" : { "type" : "geo_point" },
...
}
}
}


(system) #9