Problem with colon ':' in fieldname. Where can I find naming guidelines?

Hi,
Firstly, many thanks to Kimchy for very cool stuff.
I have a small (hopefully not silly) question. We attempted to use
colon in a field name. Nothing strange happened until we tried to pass
that field name to "fields" parameter in a query.

curl -XPOST 'localhost:9200/myIndex/myType/_search?pretty=on' -d '
{
"fields": ["abcd:field1", "field2", "field3" ],
"query": {
"query_string": {
"query": "Bonsai cool"
}
}
}
'
In the result set, only "field2" and "field3" are included in _source.
Seems that ES simply ignore the "abcd:field1". Anyway to workaround?
In our context, we really need a special character to act as a prefix
namespace separator, and don't want to do the boring replace() process
all the time.
I've thoroughly noticed your advice here:
http://elasticsearch-users.115913.n3.nabble.com/Using-space-characters-in-a-field-s-name-td2760404.html
. So, can you please show me where I can find naming guidelines for
field name?
Thanks a lot.

Can't you use underscore _ ?

David :wink:

Le 22 sept. 2011 à 20:08, Phu Le le.truong.vinh.phu@gmail.com a écrit :

Hi,
Firstly, many thanks to Kimchy for very cool stuff.
I have a small (hopefully not silly) question. We attempted to use
colon in a field name. Nothing strange happened until we tried to pass
that field name to "fields" parameter in a query.

curl -XPOST 'localhost:9200/myIndex/myType/_search?pretty=on' -d '
{
"fields": ["abcd:field1", "field2", "field3" ],
"query": {
"query_string": {
"query": "Bonsai cool"
}
}
}
'
In the result set, only "field2" and "field3" are included in _source.
Seems that ES simply ignore the "abcd:field1". Anyway to workaround?
In our context, we really need a special character to act as a prefix
namespace separator, and don't want to do the boring replace() process
all the time.
I've thoroughly noticed your advice here:
http://elasticsearch-users.115913.n3.nabble.com/Using-space-characters-in-a-field-s-name-td2760404.html
. So, can you please show me where I can find naming guidelines for
field name?
Thanks a lot.

@David: thanks for the quick reply.
Yes, it's a nice option. However, since underscore is pretty popular, and
can be part of the original fieldname as well, I prefer a special character
(if possible).
Anyway, would be great if it is explicitly stated somewhere what we should
(and shouldn't) use for field name. Besides, the indexing process doesn't
complain... :P.

Thanks,
LTVP

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Problem-with-colon-in-fieldname-Where-can-I-find-naming-guidelines-tp3359628p3359660.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

@David: thanks for the quick reply.
Yes, it's a nice option. However, since underscore is pretty popular, and
can be part of the original fieldname as well, I prefer a special character
(if possible).
Anyway, would be great if it is explicitly stated somewhere what we should
(and shouldn't) use for field name. Besides, the indexing process doesn't
complain... :P.

Thanks,
LTVP

On Fri, Sep 23, 2011 at 2:12 AM, David Pilato david@pilato.fr wrote:

Can't you use underscore _ ?

David :wink:

Le 22 sept. 2011 à 20:08, Phu Le le.truong.vinh.phu@gmail.com a écrit :

Hi,
Firstly, many thanks to Kimchy for very cool stuff.
I have a small (hopefully not silly) question. We attempted to use
colon in a field name. Nothing strange happened until we tried to pass
that field name to "fields" parameter in a query.

curl -XPOST 'localhost:9200/myIndex/myType/_search?pretty=on' -d '
{
"fields": ["abcd:field1", "field2", "field3" ],
"query": {
"query_string": {
"query": "Bonsai cool"
}
}
}
'
In the result set, only "field2" and "field3" are included in _source.
Seems that ES simply ignore the "abcd:field1". Anyway to workaround?
In our context, we really need a special character to act as a prefix
namespace separator, and don't want to do the boring replace() process
all the time.
I've thoroughly noticed your advice here:

http://elasticsearch-users.115913.n3.nabble.com/Using-space-characters-in-a-field-s-name-td2760404.html

. So, can you please show me where I can find naming guidelines for
field name?
Thanks a lot.

--
Le Truong Vinh Phu

Not sure that document exists but I wouldn't recommand using : - + ^ . as they can be used in queries.

Perhaps ; have no side effects.

David :wink:

Le 22 sept. 2011 à 20:19, Le Truong Vinh Phu le.truong.vinh.phu@gmail.com a écrit :

@David: thanks for the quick reply.
Yes, it's a nice option. However, since underscore is pretty popular, and can be part of the original fieldname as well, I prefer a special character (if possible).
Anyway, would be great if it is explicitly stated somewhere what we should (and shouldn't) use for field name. Besides, the indexing process doesn't complain... :P.

Thanks,
LTVP

On Fri, Sep 23, 2011 at 2:12 AM, David Pilato david@pilato.fr wrote:
Can't you use underscore _ ?

David :wink:

Le 22 sept. 2011 à 20:08, Phu Le le.truong.vinh.phu@gmail.com a écrit :

Hi,
Firstly, many thanks to Kimchy for very cool stuff.
I have a small (hopefully not silly) question. We attempted to use
colon in a field name. Nothing strange happened until we tried to pass
that field name to "fields" parameter in a query.

curl -XPOST 'localhost:9200/myIndex/myType/_search?pretty=on' -d '
{
"fields": ["abcd:field1", "field2", "field3" ],
"query": {
"query_string": {
"query": "Bonsai cool"
}
}
}
'
In the result set, only "field2" and "field3" are included in _source.
Seems that ES simply ignore the "abcd:field1". Anyway to workaround?
In our context, we really need a special character to act as a prefix
namespace separator, and don't want to do the boring replace() process
all the time.
I've thoroughly noticed your advice here:
http://elasticsearch-users.115913.n3.nabble.com/Using-space-characters-in-a-field-s-name-td2760404.html
. So, can you please show me where I can find naming guidelines for
field name?
Thanks a lot.

--
Le Truong Vinh Phu

Thanks a lot!
I'll try and put up some notes here.

LTVP
On Fri, Sep 23, 2011 at 2:27 AM, David Pilato david@pilato.fr wrote:

Not sure that document exists but I wouldn't recommand using : - + ^ . as
they can be used in queries.

Perhaps ; have no side effects.

David :wink:

Le 22 sept. 2011 à 20:19, Le Truong Vinh Phu le.truong.vinh.phu@gmail.com
a écrit :

@David: thanks for the quick reply.
Yes, it's a nice option. However, since underscore is pretty popular, and
can be part of the original fieldname as well, I prefer a special
character (if possible).
Anyway, would be great if it is explicitly stated somewhere what we should
(and shouldn't) use for field name. Besides, the indexing process doesn't
complain... :P.

Thanks,
LTVP

On Fri, Sep 23, 2011 at 2:12 AM, David Pilato < david@pilato.fr
david@pilato.fr> wrote:

Can't you use underscore _ ?

David :wink:

Le 22 sept. 2011 à 20:08, Phu Le < le.truong.vinh.phu@gmail.com
le.truong.vinh.phu@gmail.com> a écrit :

Hi,
Firstly, many thanks to Kimchy for very cool stuff.
I have a small (hopefully not silly) question. We attempted to use
colon in a field name. Nothing strange happened until we tried to pass
that field name to "fields" parameter in a query.

curl -XPOST 'localhost:9200/myIndex/myType/_search?pretty=on' -d '
{
"fields": ["abcd:field1", "field2", "field3" ],
"query": {
"query_string": {
"query": "Bonsai cool"
}
}
}
'
In the result set, only "field2" and "field3" are included in _source.
Seems that ES simply ignore the "abcd:field1". Anyway to workaround?
In our context, we really need a special character to act as a prefix
namespace separator, and don't want to do the boring replace() process
all the time.
I've thoroughly noticed your advice here:

http://elasticsearch-users.115913.n3.nabble.com/Using-space-characters-in-a-field-s-name-td2760404.html
http://elasticsearch-users.115913.n3.nabble.com/Using-space-characters-in-a-field-s-name-td2760404.html

. So, can you please show me where I can find naming guidelines for
field name?
Thanks a lot.

--
Le Truong Vinh Phu

--
Le Truong Vinh Phu

I guess you want "someExternalfieldname:otherInfo":"value" ? why not
feed it as object

"someExternalfieldname":{"otherInfo":"value"}

On 22 Sep., 20:30, Le Truong Vinh Phu le.truong.vinh....@gmail.com
wrote:

Thanks a lot!
I'll try and put up some notes here.

LTVP

On Fri, Sep 23, 2011 at 2:27 AM, David Pilato da...@pilato.fr wrote:

Not sure that document exists but I wouldn't recommand using : - + ^ . as
they can be used in queries.

Perhaps ; have no side effects.

David :wink:

Le 22 sept. 2011 à 20:19, Le Truong Vinh Phu le.truong.vinh....@gmail.com
a écrit :

@David: thanks for the quick reply.
Yes, it's a nice option. However, since underscore is pretty popular, and
can be part of the original fieldname as well, I prefer a special
character (if possible).
Anyway, would be great if it is explicitly stated somewhere what we should
(and shouldn't) use for field name. Besides, the indexing process doesn't
complain... :P.

Thanks,
LTVP

On Fri, Sep 23, 2011 at 2:12 AM, David Pilato < da...@pilato.fr
da...@pilato.fr> wrote:

Can't you use underscore _ ?

David :wink:

Le 22 sept. 2011 à 20:08, Phu Le < le.truong.vinh....@gmail.com
le.truong.vinh....@gmail.com> a écrit :

Hi,
Firstly, many thanks to Kimchy for very cool stuff.
I have a small (hopefully not silly) question. We attempted to use
colon in a field name. Nothing strange happened until we tried to pass
that field name to "fields" parameter in a query.

curl -XPOST 'localhost:9200/myIndex/myType/_search?pretty=on' -d '
{
"fields": ["abcd:field1", "field2", "field3" ],
"query": {
"query_string": {
"query": "Bonsai cool"
}
}
}
'
In the result set, only "field2" and "field3" are included in _source.
Seems that ES simply ignore the "abcd:field1". Anyway to workaround?
In our context, we really need a special character to act as a prefix
namespace separator, and don't want to do the boring replace() process
all the time.
I've thoroughly noticed your advice here:

http://elasticsearch-users.115913.n3.nabble.com/Using-space-character...
http://elasticsearch-users.115913.n3.nabble.com/Using-space-character...

. So, can you please show me where I can find naming guidelines for
field name?
Thanks a lot.

--
Le Truong Vinh Phu

--
Le Truong Vinh Phu

Using a field called "some:field" in the fields and wanting to load it from
source itself will fail in 0.17 because it is, internally, uses scripting to
extract the value from source. In master, it will not fail. Having said
that, I think that its better not to use ':' as the separator, as when you
try and use things like query_string on it, you will run into quirks.

On Thu, Sep 22, 2011 at 11:26 PM, Karussell tableyourtime@googlemail.comwrote:

I guess you want "someExternalfieldname:otherInfo":"value" ? why not
feed it as object

"someExternalfieldname":{"otherInfo":"value"}

On 22 Sep., 20:30, Le Truong Vinh Phu le.truong.vinh....@gmail.com
wrote:

Thanks a lot!
I'll try and put up some notes here.

LTVP

On Fri, Sep 23, 2011 at 2:27 AM, David Pilato da...@pilato.fr wrote:

Not sure that document exists but I wouldn't recommand using : - + ^ .
as
they can be used in queries.

Perhaps ; have no side effects.

David :wink:

Le 22 sept. 2011 à 20:19, Le Truong Vinh Phu <
le.truong.vinh....@gmail.com>
a écrit :

@David: thanks for the quick reply.
Yes, it's a nice option. However, since underscore is pretty popular,
and
can be part of the original fieldname as well, I prefer a special
character (if possible).
Anyway, would be great if it is explicitly stated somewhere what we
should
(and shouldn't) use for field name. Besides, the indexing process
doesn't
complain... :P.

Thanks,
LTVP

On Fri, Sep 23, 2011 at 2:12 AM, David Pilato < da...@pilato.fr
da...@pilato.fr> wrote:

Can't you use underscore _ ?

David :wink:

Le 22 sept. 2011 à 20:08, Phu Le < le.truong.vinh....@gmail.com
le.truong.vinh....@gmail.com> a écrit :

Hi,
Firstly, many thanks to Kimchy for very cool stuff.
I have a small (hopefully not silly) question. We attempted to use
colon in a field name. Nothing strange happened until we tried to
pass
that field name to "fields" parameter in a query.

curl -XPOST 'localhost:9200/myIndex/myType/_search?pretty=on' -d '
{
"fields": ["abcd:field1", "field2", "field3" ],
"query": {
"query_string": {
"query": "Bonsai cool"
}
}
}
'
In the result set, only "field2" and "field3" are included in
_source.
Seems that ES simply ignore the "abcd:field1". Anyway to workaround?
In our context, we really need a special character to act as a
prefix
namespace separator, and don't want to do the boring replace()
process
all the time.
I've thoroughly noticed your advice here:

<
http://elasticsearch-users.115913.n3.nabble.com/Using-space-character...>
http://elasticsearch-users.115913.n3.nabble.com/Using-space-character.
..

. So, can you please show me where I can find naming guidelines for
field name?
Thanks a lot.

--
Le Truong Vinh Phu

--
Le Truong Vinh Phu