Name conflicts between types and fields


(Karol Gwaj) #1

hi,

is there any way to indicate that field name path used in the query
represents absolute path ?
looks like elasticsearch is recognizing that field path starts with type
name and removes it before executing query

consider example below:

  1. insert two test documents:

POST test/sublocality/1
{
"name" : "xxx",
"country" :
{
"name" : "yyy"
}
}

POST test/country/1
{
"name" : "zzz",
"country" :
{
"name" : "yyy"
}
}

  1. execute facet query:

POST test/_search
{
"facets": {
"term": {
"terms": {
"field": "country.name",
"size": 10
}
}
}
}

i will expect that facet response will contain only one term 'yyy' with
count 2
instead im getting 'xxx' with count 1 and 'zzz' with count 1

so looks like elasticsearch recognized that field name is prefixed with
type (country) and trimmed it:

POST test/_search
{
"facets": {
"term": {
"terms": {
"field": "name",
"size": 10
}
}
}
}

any idea how to get around it without renaming types and fields ?
im using elasticsearch 2.x

Thx,

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/53b99101-bf16-4905-98c5-49af2217e579%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vineeth mohan-2) #2

Hello Karol ,

This is definitely a bug.

I think i understand what happens.
There is no type support in lucene and ES would be storing all fields as

TYPE.field.full.path format

Which means , there would be country.name and country.country.name field in
the index.
If you try with the following query -

{
"facets": {
"term": {
"terms": {
"field": "country.country.name",
"size": 10
}
}
}
}
You will get the expected result.

I have filed a ISSUE -

Thanks
Vineeth

On Fri, Aug 22, 2014 at 4:37 PM, Karol Gwaj karol@gwaj.me wrote:

hi,

is there any way to indicate that field name path used in the query
represents absolute path ?
looks like elasticsearch is recognizing that field path starts with type
name and removes it before executing query

consider example below:

  1. insert two test documents:

POST test/sublocality/1
{
"name" : "xxx",
"country" :
{
"name" : "yyy"
}
}

POST test/country/1
{
"name" : "zzz",
"country" :
{
"name" : "yyy"
}
}

  1. execute facet query:

POST test/_search
{
"facets": {
"term": {
"terms": {
"field": "country.name http://country.name",
"size": 10
}
}
}
}

i will expect that facet response will contain only one term 'yyy' with
count 2
instead im getting 'xxx' with count 1 and 'zzz' with count 1

so looks like elasticsearch recognized that field name is prefixed with
type (country) and trimmed it:

POST test/_search
{
"facets": {
"term": {
"terms": {
"field": "name",
"size": 10
}
}
}
}

any idea how to get around it without renaming types and fields ?
im using elasticsearch 2.x

Thx,

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/53b99101-bf16-4905-98c5-49af2217e579%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/53b99101-bf16-4905-98c5-49af2217e579%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5mRzRrwhA6e%2BTgf%3DRck2dHA-VSSsxr1dnorG%3D6EUkiBXw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3