Using space characters in a field's name

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using space characters in a field's name

Lar Mader
I apologize in advance if this question has been addressed, but I
haven't been able to find it.

I have a document that I want to index that would look something like
this:

{
"description":"foo",
"field name with spaces in it":"test"
}

Note that the second field name has spaces in it. This seems to break
the ability to then query on that field name. That is, I am
constructing a QueryStringQueryBuilder using the Java API like this:

QueryBuilders.queryString("field name with spaces in it:\"test\"");

But this query never finds the document. Is there a way to do this?
Perhaps there is a way to escape the space characters or something?

Thanks,
lmader
Reply | Threaded
Open this post in threaded view
|

Re: Using space characters in a field's name

kimchy
Administrator
Spaces in field names will lead to all sorts of problems, its best/crucial to avoid them.

On Thursday, March 31, 2011 at 10:41 PM, lmader wrote:

I apologize in advance if this question has been addressed, but I
haven't been able to find it.

I have a document that I want to index that would look something like
this:

{
"description":"foo",
"field name with spaces in it":"test"
}

Note that the second field name has spaces in it. This seems to break
the ability to then query on that field name. That is, I am
constructing a QueryStringQueryBuilder using the Java API like this:

QueryBuilders.queryString("field name with spaces in it:\"test\"");

But this query never finds the document. Is there a way to do this?
Perhaps there is a way to escape the space characters or something?

Thanks,
lmader