create a simple document with 2 fields, one with "." in field name,
another without (PUT into h/xx/1)
{
"doc_text": "hello world",
"doc.text": "hello world"
}
issue a search query for doc_text field with highlight for doc_text
field, observe that results return with highlight (POST into h/xx/
_search)
{
"query": {
"query_string": {
"default_field": "doc_text",
"query": "world"
}
},
"highlight": {
"pre_tags": [ "" ],
"post_tags": ["" ],
"fields": {
"doc_text": {
"fragment_size": 99999,
"number_of_fragments": 9
}
}
}
}
issue a search query for doc.text field with highlight for doc.text
field, observe that results return without highlight (POST into h/xx/
_search)
{
"query": {
"query_string": {
"default_field": "doc.text",
"query": "world"
}
},
"highlight": {
"pre_tags": [ "" ],
"post_tags": ["" ],
"fields": {
"doc.text": {
"fragment_size": 99999,
"number_of_fragments": 9
}
}
}
}
Is this a known issue (I searched forums but could not find anything)
or am I doing something wrong?
Note that if in step 2 I specify fields to be stored,as below
everything works as expected.
create a simple document with 2 fields, one with "." in field name,
another without (PUT into h/xx/1)
{
"doc_text": "hello world",
"doc.text": "hello world"
}
issue a search query for doc_text field with highlight for doc_text
field, observe that results return with highlight (POST into h/xx/
_search)
{
"query": {
"query_string": {
"default_field": "doc_text",
"query": "world"
}
},
"highlight": {
"pre_tags": [ "" ],
"post_tags": ["" ],
"fields": {
"doc_text": {
"fragment_size": 99999,
"number_of_fragments": 9
}
}
}
}
issue a search query for doc.text field with highlight for doc.text
field, observe that results return without highlight (POST into h/xx/
_search)
{
"query": {
"query_string": {
"default_field": "doc.text",
"query": "world"
}
},
"highlight": {
"pre_tags": [ "" ],
"post_tags": ["" ],
"fields": {
"doc.text": {
"fragment_size": 99999,
"number_of_fragments": 9
}
}
}
}
Is this a known issue (I searched forums but could not find anything)
or am I doing something wrong?
Note that if in step 2 I specify fields to be stored,as below
everything works as expected.
create a simple document with 2 fields, one with "." in field name,
another without (PUT into h/xx/1)
{
"doc_text": "hello world",
"doc.text": "hello world"
}
issue a search query for doc_text field with highlight for doc_text
field, observe that results return with highlight (POST into h/xx/
_search)
{
"query": {
"query_string": {
"default_field": "doc_text",
"query": "world"
}
},
"highlight": {
"pre_tags": [ "" ],
"post_tags": ["" ],
"fields": {
"doc_text": {
"fragment_size": 99999,
"number_of_fragments": 9
}
}
}
}
issue a search query for doc.text field with highlight for doc.text
field, observe that results return without highlight (POST into h/xx/
_search)
{
"query": {
"query_string": {
"default_field": "doc.text",
"query": "world"
}
},
"highlight": {
"pre_tags": [ "" ],
"post_tags": ["" ],
"fields": {
"doc.text": {
"fragment_size": 99999,
"number_of_fragments": 9
}
}
}
}
Is this a known issue (I searched forums but could not find anything)
or am I doing something wrong?
Note that if in step 2 I specify fields to be stored,as below
everything works as expected.
The reason we are relying on “.” in field name (and now considering
changing to something else as there seems to be other problem (i.e.
accessing field through source as in _source.doc.text)) is that we
ended up having two indexes with essentially duplicated data – the
first index contains three level nested documents (i.e. foo.bar.edu)
where’s the second index is flat and contains leaves with all fields
from parent and grandparent duplicated in every leaf. To keep the
names the same between the indexes we have placed dots to concatenate
field names for the "flat" index.
The reason we need that “flat” index is that in the search results
need only leafs that match conditions (as opposed to all leafs) and we
cannot get it at the moment from our “nested” index (and we need
nested index, because we need to have docs “grouped” by parents).
The idea is to keep this “flat” index till Lucene 3.6/4.0 makes a
release and the release makes its way into Elastic Search – in
addition to BlockJoinQuery() (which ES uses for “nested” queries) they
have added support for query which works in other direction
(ToChildBlockJoinQuery() Changing Bits: ToChildBlockJoinQuery in Lucene)
The reason I bring this up is that we have partially back-ported
ToChildBlockJoinQuery() into recent fork of ES but ultimately
abandoned the effort and went for the second index instead (it’s not
quite clear what is the best way to expose results from this query
through ES JSON, then there could be other issues we don’t know about,
plus the overhead of extra index is not that big). In any case,
porting of ToChildBlockJoinQuery() likely will have to be done no
matter what once ES chooses to move to next version of Lucene, and I’d
be happy to contribute that porting work through sharing it on github
– let me know if you’re interested.
create a simple document with 2 fields, one with "." in field name,
another without (PUT into h/xx/1)
{
"doc_text": "hello world",
"doc.text": "hello world"
}
issue a search query for doc_text field with highlight for doc_text
field, observe that results return with highlight (POST into h/xx/
_search)
{
"query": {
"query_string": {
"default_field": "doc_text",
"query": "world"
}
},
"highlight": {
"pre_tags": [ "" ],
"post_tags": ["" ],
"fields": {
"doc_text": {
"fragment_size": 99999,
"number_of_fragments": 9
}
}
}
}
issue a search query for doc.text field with highlight for doc.text
field, observe that results return without highlight (POST into h/xx/
_search)
{
"query": {
"query_string": {
"default_field": "doc.text",
"query": "world"
}
},
"highlight": {
"pre_tags": [ "" ],
"post_tags": ["" ],
"fields": {
"doc.text": {
"fragment_size": 99999,
"number_of_fragments": 9
}
}
}
}
Is this a known issue (I searched forums but could not find anything)
or am I doing something wrong?
Note that if in step 2 I specify fields to be stored,as below
everything works as expected.
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.