Faceted search fails when the script field regards to more than 1 level deep property


(Treff7es) #1

Hi,

I started to use faceted search with elastic and it works quite well and
fast, but it always fails if I try to use Terms facet with a script field
that is pointing to property which depth is more than 1 level deep. (for
example _source.prop.prop1)
It is only fails if the query resultset has at least 1 document that does
not have that property I'm looking for. So for example if I'm looking for
_source.prop.prop1 then it fails if I have at least one document that don't
have the _source.prop.prop1 property in the resultset.
I think correctly the faceted search should skip those documents that does
not have the faceted property and it should not throw a PropertyAccessException[[Error:
could not access: prop; exeception, which happens if the property depth is
1.

For example this query fails:
{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.prop.prop1"}}}}'

But this query not:
{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.testProperty"}}}}

However the first query won't fail if I use a query that matches on every
document that has a property I'm using in term facet :
{"query":{"query_string":{"query":"prop.prop1:*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.prop.prop1"}}}}'

For more information see:

Is this how it should work or it is a bug?

Thanks,
Tamas


(Shay Banon) #2

mvel support null value property navigation using the .? syntax, here is
how it should look like: curl -XGET
http://localhost:9200/twitter/tweet/_search -d
'{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.?prop.?prop1"}}}}'.

Note, faceting on _source means that for each hit that matches the query,
the _source will be loaded and parsed, using doc prefix usually makes more
sense.

On Tue, May 22, 2012 at 12:00 AM, Treff7es treff7es@gmail.com wrote:

Hi,

I started to use faceted search with elastic and it works quite well and
fast, but it always fails if I try to use Terms facet with a script field
that is pointing to property which depth is more than 1 level deep. (for
example _source.prop.prop1)
It is only fails if the query resultset has at least 1 document that does
not have that property I'm looking for. So for example if I'm looking for
_source.prop.prop1 then it fails if I have at least one document that don't
have the _source.prop.prop1 property in the resultset.
I think correctly the faceted search should skip those documents that does
not have the faceted property and it should not throw a PropertyAccessException[[Error:
could not access: prop; exeception, which happens if the property depth is
1.

For example this query fails:

{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.prop.prop1"}}}}'

But this query not:

{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.testProperty"}}}}

However the first query won't fail if I use a query that matches on every
document that has a property I'm using in term facet :

{"query":{"query_string":{"query":"prop.prop1:*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.prop.prop1"}}}}'

For more information see:
https://gist.github.com/2764851

Is this how it should work or it is a bug?

Thanks,
Tamas


(Treff7es) #3

Hi,

Thanks Shay for the answer.
My soulution was adding an exist filter for the requested property to the
facet query.

What do you mean on doc prefix?

I used _source because for example for "Acme Institute" I wanted to get
back as "Acme Institute" and not as "Acme" and "Institute" however when I'm
doing search I wanted to be searchable with "Acme" and "Institue" so I
couldn't use Keyword analyzer for the expression.

Thanks,
Tamas

On Thursday, May 24, 2012 12:46:46 AM UTC+2, kimchy wrote:

mvel support null value property navigation using the .? syntax, here is
how it should look like: curl -XGET
http://localhost:9200/twitter/tweet/_search -d
'{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.?prop.?prop1"}}}}'.

Note, faceting on _source means that for each hit that matches the query,
the _source will be loaded and parsed, using doc prefix usually makes more
sense.

On Tue, May 22, 2012 at 12:00 AM, Treff7es treff7es@gmail.com wrote:

Hi,

I started to use faceted search with elastic and it works quite well and
fast, but it always fails if I try to use Terms facet with a script field
that is pointing to property which depth is more than 1 level deep. (for
example _source.prop.prop1)
It is only fails if the query resultset has at least 1 document that does
not have that property I'm looking for. So for example if I'm looking for
_source.prop.prop1 then it fails if I have at least one document that don't
have the _source.prop.prop1 property in the resultset.
I think correctly the faceted search should skip those documents that
does not have the faceted property and it should not throw a PropertyAccessException[[Error:
could not access: prop; exeception, which happens if the property depth is
1.

For example this query fails:

{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.prop.prop1"}}}}'

But this query not:

{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.testProperty"}}}}

However the first query won't fail if I use a query that matches on every
document that has a property I'm using in term facet :

{"query":{"query_string":{"query":"prop.prop1:*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.prop.prop1"}}}}'

For more information see:
https://gist.github.com/2764851

Is this how it should work or it is a bug?

Thanks,
Tamas

On Thursday, May 24, 2012 12:46:46 AM UTC+2, kimchy wrote:

mvel support null value property navigation using the .? syntax, here is
how it should look like: curl -XGET
http://localhost:9200/twitter/tweet/_search -d
'{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.?prop.?prop1"}}}}'.

Note, faceting on _source means that for each hit that matches the query,
the _source will be loaded and parsed, using doc prefix usually makes more
sense.

On Tue, May 22, 2012 at 12:00 AM, Treff7es treff7es@gmail.com wrote:

Hi,

I started to use faceted search with elastic and it works quite well and
fast, but it always fails if I try to use Terms facet with a script field
that is pointing to property which depth is more than 1 level deep. (for
example _source.prop.prop1)
It is only fails if the query resultset has at least 1 document that does
not have that property I'm looking for. So for example if I'm looking for
_source.prop.prop1 then it fails if I have at least one document that don't
have the _source.prop.prop1 property in the resultset.
I think correctly the faceted search should skip those documents that
does not have the faceted property and it should not throw a PropertyAccessException[[Error:
could not access: prop; exeception, which happens if the property depth is
1.

For example this query fails:

{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.prop.prop1"}}}}'

But this query not:

{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.testProperty"}}}}

However the first query won't fail if I use a query that matches on every
document that has a property I'm using in term facet :

{"query":{"query_string":{"query":"prop.prop1:*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.prop.prop1"}}}}'

For more information see:
https://gist.github.com/2764851

Is this how it should work or it is a bug?

Thanks,
Tamas

On Thursday, May 24, 2012 12:46:46 AM UTC+2, kimchy wrote:

mvel support null value property navigation using the .? syntax, here is
how it should look like: curl -XGET
http://localhost:9200/twitter/tweet/_search -d
'{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.?prop.?prop1"}}}}'.

Note, faceting on _source means that for each hit that matches the query,
the _source will be loaded and parsed, using doc prefix usually makes more
sense.

On Tue, May 22, 2012 at 12:00 AM, Treff7es treff7es@gmail.com wrote:

Hi,

I started to use faceted search with elastic and it works quite well and
fast, but it always fails if I try to use Terms facet with a script field
that is pointing to property which depth is more than 1 level deep. (for
example _source.prop.prop1)
It is only fails if the query resultset has at least 1 document that does
not have that property I'm looking for. So for example if I'm looking for
_source.prop.prop1 then it fails if I have at least one document that don't
have the _source.prop.prop1 property in the resultset.
I think correctly the faceted search should skip those documents that
does not have the faceted property and it should not throw a PropertyAccessException[[Error:
could not access: prop; exeception, which happens if the property depth is
1.

For example this query fails:

{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.prop.prop1"}}}}'

But this query not:

{"query":{"query_string":{"query":"*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.testProperty"}}}}

However the first query won't fail if I use a query that matches on every
document that has a property I'm using in term facet :

{"query":{"query_string":{"query":"prop.prop1:*"}},"facets":{"termStatFacet":{"terms":{"size":500,"script":"_source.prop.prop1"}}}}'

For more information see:
https://gist.github.com/2764851

Is this how it should work or it is a bug?

Thanks,
Tamas


(Shay Banon) #4

_source ends up loading each json doc and parsing it, doc will preload all
the data to memory and make accessing it considerably faster. You can map
the field as not analyzed and then use doc on that field, which will give
you the content without it being broken down to terms. You can also use
multi field mapping to have one version analyzed, and one that is not.

On Fri, May 25, 2012 at 8:21 AM, Treff7es treff7es@gmail.com wrote:

Hi,

Thanks Shay for the answer.
My soulution was adding an exist filter for the requested property to the
facet query.

What do you mean on doc prefix?

I used _source because for example for "Acme Institute" I wanted to get
back as "Acme Institute" and not as "Acme" and "Institute" however when I'm
doing search I wanted to be searchable with "Acme" and "Institue" so I
couldn't use Keyword analyzer for the expression.

Thanks,
Tamas

On Thursday, May 24, 2012 12:46:46 AM UTC+2, kimchy wrote:

mvel support null value property navigation using the .? syntax, here is
how it should look like: curl -XGET http://localhost:9200/twitter/**
tweet/_search http://localhost:9200/twitter/tweet/_search -d
'{"query":{"query_string":{"query":"*"}},"facets":{"
termStatFacet":{"terms":{"size":500,"script":"_source.?
prop.?prop1"}}}}'.

Note, faceting on _source means that for each hit that matches the query,
the _source will be loaded and parsed, using doc prefix usually makes more
sense.

On Tue, May 22, 2012 at 12:00 AM, Treff7es treff7es@gmail.com wrote:

Hi,

I started to use faceted search with elastic and it works quite well and
fast, but it always fails if I try to use Terms facet with a script field
that is pointing to property which depth is more than 1 level deep. (for
example _source.prop.prop1)
It is only fails if the query resultset has at least 1 document that
does not have that property I'm looking for. So for example if I'm looking
for _source.prop.prop1 then it fails if I have at least one document that
don't have the _source.prop.prop1 property in the resultset.
I think correctly the faceted search should skip those documents that
does not have the faceted property and it should not throw a
PropertyAccessException[[**Error: could not access: prop; exeception,
which happens if the property depth is 1.

For example this query fails:
{"query":{"query_string":{"query":"*"}},"facets":{"
termStatFacet":{"terms":{"size":500,"script":"_source.
prop.prop1"}}}}'

But this query not:
{"query":{"query_string":{"query":"*"}},"facets":{"
termStatFacet":{"terms":{"size":500,"script":"_source.
testProperty"}}}}

However the first query won't fail if I use a query that matches on
every document that has a property I'm using in term facet :
{"query":{"query_string":{"query":"prop.prop1:*"}},"
facets":{"termStatFacet":{"terms":{"size":500,"script":"_
source.prop.prop1"}}}}'

For more information see:
https://gist.github.com/**2764851 https://gist.github.com/2764851

Is this how it should work or it is a bug?

Thanks,
Tamas

On Thursday, May 24, 2012 12:46:46 AM UTC+2, kimchy wrote:

mvel support null value property navigation using the .? syntax, here is
how it should look like: curl -XGET http://localhost:9200/twitter/**
tweet/_search http://localhost:9200/twitter/tweet/_search -d
'{"query":{"query_string":{"query":"*"}},"facets":{"
termStatFacet":{"terms":{"size":500,"script":"_source.?
prop.?prop1"}}}}'.

Note, faceting on _source means that for each hit that matches the query,
the _source will be loaded and parsed, using doc prefix usually makes more
sense.

On Tue, May 22, 2012 at 12:00 AM, Treff7es treff7es@gmail.com wrote:

Hi,

I started to use faceted search with elastic and it works quite well and
fast, but it always fails if I try to use Terms facet with a script field
that is pointing to property which depth is more than 1 level deep. (for
example _source.prop.prop1)
It is only fails if the query resultset has at least 1 document that
does not have that property I'm looking for. So for example if I'm looking
for _source.prop.prop1 then it fails if I have at least one document that
don't have the _source.prop.prop1 property in the resultset.
I think correctly the faceted search should skip those documents that
does not have the faceted property and it should not throw a
PropertyAccessException[[**Error: could not access: prop; exeception,
which happens if the property depth is 1.

For example this query fails:
{"query":{"query_string":{"query":"*"}},"facets":{"
termStatFacet":{"terms":{"size":500,"script":"_source.
prop.prop1"}}}}'

But this query not:
{"query":{"query_string":{"query":"*"}},"facets":{"
termStatFacet":{"terms":{"size":500,"script":"_source.
testProperty"}}}}

However the first query won't fail if I use a query that matches on
every document that has a property I'm using in term facet :
{"query":{"query_string":{"query":"prop.prop1:*"}},"
facets":{"termStatFacet":{"terms":{"size":500,"script":"_
source.prop.prop1"}}}}'

For more information see:
https://gist.github.com/**2764851 https://gist.github.com/2764851

Is this how it should work or it is a bug?

Thanks,
Tamas

On Thursday, May 24, 2012 12:46:46 AM UTC+2, kimchy wrote:

mvel support null value property navigation using the .? syntax, here is
how it should look like: curl -XGET http://localhost:9200/twitter/**
tweet/_search http://localhost:9200/twitter/tweet/_search -d
'{"query":{"query_string":{"query":"*"}},"facets":{"
termStatFacet":{"terms":{"size":500,"script":"_source.?
prop.?prop1"}}}}'.

Note, faceting on _source means that for each hit that matches the query,
the _source will be loaded and parsed, using doc prefix usually makes more
sense.

On Tue, May 22, 2012 at 12:00 AM, Treff7es treff7es@gmail.com wrote:

Hi,

I started to use faceted search with elastic and it works quite well and
fast, but it always fails if I try to use Terms facet with a script field
that is pointing to property which depth is more than 1 level deep. (for
example _source.prop.prop1)
It is only fails if the query resultset has at least 1 document that
does not have that property I'm looking for. So for example if I'm looking
for _source.prop.prop1 then it fails if I have at least one document that
don't have the _source.prop.prop1 property in the resultset.
I think correctly the faceted search should skip those documents that
does not have the faceted property and it should not throw a
PropertyAccessException[[**Error: could not access: prop; exeception,
which happens if the property depth is 1.

For example this query fails:
{"query":{"query_string":{"query":"*"}},"facets":{"
termStatFacet":{"terms":{"size":500,"script":"_source.
prop.prop1"}}}}'

But this query not:
{"query":{"query_string":{"query":"*"}},"facets":{"
termStatFacet":{"terms":{"size":500,"script":"_source.
testProperty"}}}}

However the first query won't fail if I use a query that matches on
every document that has a property I'm using in term facet :
{"query":{"query_string":{"query":"prop.prop1:*"}},"
facets":{"termStatFacet":{"terms":{"size":500,"script":"_
source.prop.prop1"}}}}'

For more information see:
https://gist.github.com/**2764851 https://gist.github.com/2764851

Is this how it should work or it is a bug?

Thanks,
Tamas


(system) #5