Are Facet Filters applied after trying to map an element?

Hey everyone,
I'm having a problem with the facet filter "exists"... My document design
looks like this: http://pastie.org/4279850 ... I want to be able to do a
statistical facet for date.cpX to get an aggregation.. So, an example use
case is querying all users for docuements that had a session in a
particular date range.. Then, I would aggregate each checkpoint for every
date in that range.. However, not all documents will have a session on
every day.. That's where I hoped to apply my facet filter
here: http://pastie.org/4279233

As you can see in the query, I first want to match all, and then for all
docuemnts that have a field "2016-07-01", I want to add up the values for
"2016-07-01.cp1"... However, I get a "No mapping found for field"
exception.. I would think this shouldn't happen, because I am disregarding
documents that don't have a 2016-07-01 date stamp.. (also, here is the
exception I get: http://pastie.org/4279892 )

Any help would be much appreciated!

Thanks,
Jack

The exists filter can't point to a json "object", it needs to be pointing
to an actual field (that ends up being indexed). You can simply use the
field you are faceting on.

On Wed, Jul 18, 2012 at 1:32 PM, Jack Markarian markarianhj@gmail.comwrote:

Hey everyone,
I'm having a problem with the facet filter "exists"... My document design
looks like this: http://pastie.org/4279850 ... I want to be able to do a
statistical facet for date.cpX to get an aggregation.. So, an example use
case is querying all users for docuements that had a session in a
particular date range.. Then, I would aggregate each checkpoint for every
date in that range.. However, not all documents will have a session on
every day.. That's where I hoped to apply my facet filter here:
http://pastie.org/4279233

As you can see in the query, I first want to match all, and then for all
docuemnts that have a field "2016-07-01", I want to add up the values for
"2016-07-01.cp1"... However, I get a "No mapping found for field"
exception.. I would think this shouldn't happen, because I am disregarding
documents that don't have a 2016-07-01 date stamp.. (also, here is the
exception I get: http://pastie.org/4279892 )

Any help would be much appreciated!

Thanks,
Jack

Thanks Shay! I apologize in advance if I'm slow with this, as it is pretty
new (but super easy and powerful to use)..

So, I changed the query to look like this:
curl -XGET 'http://localhost:9200/angrybirdsv3/user/_search?pretty=true' -d
'{"query" : {"match_all" : { }},"facets" : {"stat1" : {"statistical" :
{"fields" : ["2016-07-01.cp1"]}, "facet_filter" : {"exists" : {"field" :
"2016-07-01.cp1"}}}}}'

Now I am using exists on the field itself.. but I get the same exact
error.. Is that what you meant by not using exists on the object but
instead the field in the object? If so, then it still didn't work for me.

On Wednesday, July 18, 2012 1:54:52 PM UTC-7, kimchy wrote:

The exists filter can't point to a json "object", it needs to be pointing
to an actual field (that ends up being indexed). You can simply use the
field you are faceting on.

On Wed, Jul 18, 2012 at 1:32 PM, Jack Markarian wrote:

Hey everyone,
I'm having a problem with the facet filter "exists"... My document design
looks like this: http://pastie.org/4279850 ... I want to be able to do a
statistical facet for date.cpX to get an aggregation.. So, an example use
case is querying all users for docuements that had a session in a
particular date range.. Then, I would aggregate each checkpoint for every
date in that range.. However, not all documents will have a session on
every day.. That's where I hoped to apply my facet filter here:
http://pastie.org/4279233

As you can see in the query, I first want to match all, and then for all
docuemnts that have a field "2016-07-01", I want to add up the values for
"2016-07-01.cp1"... However, I get a "No mapping found for field"
exception.. I would think this shouldn't happen, because I am disregarding
documents that don't have a 2016-07-01 date stamp.. (also, here is the
exception I get: http://pastie.org/4279892 )

Any help would be much appreciated!

Thanks,
Jack

Also, in case I didn't explain it well previously, neither of the documents
have the object "2016-07-01", so I would expect the facet to return 0s (or
NaNs or whatever) for the statistical fields becuase they were totally
ignored in the faceting..

On Wednesday, July 18, 2012 2:17:58 PM UTC-7, jackM wrote:

Thanks Shay! I apologize in advance if I'm slow with this, as it is
pretty new (but super easy and powerful to use)..

So, I changed the query to look like this:
curl -XGET 'http://localhost:9200/angrybirdsv3/user/_search?pretty=true'
-d '{"query" : {"match_all" : { }},"facets" : {"stat1" : {"statistical" :
{"fields" : ["2016-07-01.cp1"]}, "facet_filter" : {"exists" : {"field" :
"2016-07-01.cp1"}}}}}'

Now I am using exists on the field itself.. but I get the same exact
error.. Is that what you meant by not using exists on the object but
instead the field in the object? If so, then it still didn't work for me.

On Wednesday, July 18, 2012 1:54:52 PM UTC-7, kimchy wrote:

The exists filter can't point to a json "object", it needs to be pointing
to an actual field (that ends up being indexed). You can simply use the
field you are faceting on.

On Wed, Jul 18, 2012 at 1:32 PM, Jack Markarian wrote:

Hey everyone,
I'm having a problem with the facet filter "exists"... My document
design looks like this: http://pastie.org/4279850 ... I want to be able
to do a statistical facet for date.cpX to get an aggregation.. So, an
example use case is querying all users for docuements that had a session in
a particular date range.. Then, I would aggregate each checkpoint for every
date in that range.. However, not all documents will have a session on
every day.. That's where I hoped to apply my facet filter here:
http://pastie.org/4279233

As you can see in the query, I first want to match all, and then for all
docuemnts that have a field "2016-07-01", I want to add up the values for
"2016-07-01.cp1"... However, I get a "No mapping found for field"
exception.. I would think this shouldn't happen, because I am disregarding
documents that don't have a 2016-07-01 date stamp.. (also, here is the
exception I get: http://pastie.org/4279892 )

Any help would be much appreciated!

Thanks,
Jack

Nevermind.. I figured out the problem.. I am using a dynamic mapping, so if
I have a mapping in my query that doesn't match any documents, an exception
is thrown (I assume the query is validated against the index/type mapping
before being executed, and since no documents have that field, a mapping
was never created in the dynamic mapping for the type).. so in conclusion,
as long as I run the facet filter against a field that has been indexed at
least once before, then I should be golden.. right?

Thanks for the help, Shay.. like I said, I'll prob run into a bunch
of elementary problems until I get a hang of this, so please be patient! :slight_smile:

Thanks,
Jack

On Wed, 2012-07-18 at 13:32 -0700, Jack Markarian wrote:

Hey everyone,
I'm having a problem with the facet filter "exists"... My document
design looks like this: http://pastie.org/4279850 ... I want to be
able to do a statistical facet for date.cpX to get an aggregation..
So, an example use case is querying all users for docuements that had
a session in a particular date range.. Then, I would aggregate each
checkpoint for every date in that range.. However, not all documents
will have a session on every day.. That's where I hoped to apply my
facet filter here: http://pastie.org/4279233

An object/hash container is not indexed as a field - only its scalar (or
array of scalars) contents. Try running the 'exists' filter on
'2016-07-01.cp1' instead.

clint

As you can see in the query, I first want to match all, and then for
all docuemnts that have a field "2016-07-01", I want to add up the
values for "2016-07-01.cp1"... However, I get a "No mapping found for
field" exception.. I would think this shouldn't happen, because I am
disregarding documents that don't have a 2016-07-01 date stamp..
(also, here is the exception I get: http://pastie.org/4279892 )

Any help would be much appreciated!

Thanks,
Jack

I'm having similar problems for facets with dynamic fields.
Is it possible to ignore 'mapping does not exist' issues and don't raise
exceptions?

Le jeudi 19 juillet 2012 14:00:15 UTC+6, Clinton Gormley a écrit :

On Wed, 2012-07-18 at 13:32 -0700, Jack Markarian wrote:

Hey everyone,
I'm having a problem with the facet filter "exists"... My document
design looks like this: http://pastie.org/4279850 ... I want to be
able to do a statistical facet for date.cpX to get an aggregation..
So, an example use case is querying all users for docuements that had
a session in a particular date range.. Then, I would aggregate each
checkpoint for every date in that range.. However, not all documents
will have a session on every day.. That's where I hoped to apply my
facet filter here: http://pastie.org/4279233

An object/hash container is not indexed as a field - only its scalar (or
array of scalars) contents. Try running the 'exists' filter on
'2016-07-01.cp1' instead.

clint

As you can see in the query, I first want to match all, and then for
all docuemnts that have a field "2016-07-01", I want to add up the
values for "2016-07-01.cp1"... However, I get a "No mapping found for
field" exception.. I would think this shouldn't happen, because I am
disregarding documents that don't have a 2016-07-01 date stamp..
(also, here is the exception I get: http://pastie.org/4279892 )

Any help would be much appreciated!

Thanks,
Jack

--

Hi rauan, what I ended up doing is reading the mapping json into local cache periodically and when constructing the facet query, I would verify that the field I want to facet on is in the mapping.. If not in the mapping then I don't include it in the query.. The no mapping exception is some initial query validation that is run prior to your query executing so I don't think there is another way around it.

Sent from my iPhone

On Dec 1, 2012, at 10:43 PM, Rauan Maemirov rauan1987@gmail.com wrote:

I'm having similar problems for facets with dynamic fields.
Is it possible to ignore 'mapping does not exist' issues and don't raise exceptions?

Le jeudi 19 juillet 2012 14:00:15 UTC+6, Clinton Gormley a écrit :

On Wed, 2012-07-18 at 13:32 -0700, Jack Markarian wrote:

Hey everyone,
I'm having a problem with the facet filter "exists"... My document
design looks like this: http://pastie.org/4279850 ... I want to be
able to do a statistical facet for date.cpX to get an aggregation..
So, an example use case is querying all users for docuements that had
a session in a particular date range.. Then, I would aggregate each
checkpoint for every date in that range.. However, not all documents
will have a session on every day.. That's where I hoped to apply my
facet filter here: http://pastie.org/4279233

An object/hash container is not indexed as a field - only its scalar (or
array of scalars) contents. Try running the 'exists' filter on
'2016-07-01.cp1' instead.

clint

As you can see in the query, I first want to match all, and then for
all docuemnts that have a field "2016-07-01", I want to add up the
values for "2016-07-01.cp1"... However, I get a "No mapping found for
field" exception.. I would think this shouldn't happen, because I am
disregarding documents that don't have a 2016-07-01 date stamp..
(also, here is the exception I get: http://pastie.org/4279892 )

Any help would be much appreciated!

Thanks,
Jack

--

--