I have a field called createdDate of type string and it's not analyzed. A
sample entry for this field is "20120724120000"
I like to run facets on this field after a certain query and do a facet
count. However I want the facet to count based on a certain portion of the
field. I am using the regex option to this.
for example i have a few ES documents that contain:
20120724120000
20120724120001
20120724120002
20120725120021
20120726120034
i like facets to count 20120724 =t 3, 20120725 = 1, 20120726 = 1 etc.
This is a copy from some stuff I was recently working with, so you need to
modify a bit to meet your details (fields and requirement).
Sujoy,
On Tuesday, July 24, 2012 9:17:34 PM UTC+5:30, Joe Wong wrote:
I have a field called createdDate of type string and it's not analyzed. A
sample entry for this field is "20120724120000"
I like to run facets on this field after a certain query and do a facet
count. However I want the facet to count based on a certain portion of the
field. I am using the regex option to this.
for example i have a few ES documents that contain:
20120724120000
20120724120001
20120724120002
20120725120021
20120726120034
i like facets to count 20120724 =t 3, 20120725 = 1, 20120726 = 1 etc.
This is a copy from some stuff I was recently working with, so you need to
modify a bit to meet your details (fields and requirement).
Sujoy,
On Tuesday, July 24, 2012 9:17:34 PM UTC+5:30, Joe Wong wrote:
I have a field called createdDate of type string and it's not analyzed. A
sample entry for this field is "20120724120000"
I like to run facets on this field after a certain query and do a facet
count. However I want the facet to count based on a certain portion of the
field. I am using the regex option to this.
for example i have a few ES documents that contain:
20120724120000
20120724120001
20120724120002
20120725120021
20120726120034
i like facets to count 20120724 =t 3, 20120725 = 1, 20120726 = 1 etc.
Using regex patterns in terms facet probably doesn't modify the elements,
but used to determine whether to include a particular element for facet
calculation or not. I am not entirely sure on the above statement, but that
is what i interpret from the documents - The terms API allows to define
regex expression that will control which terms will be included in the
faceted list.
Sorry, I am not an expert here, but since I faced the same problem as
yours, I provided the solution I used as a suggestion.
Thanks,
Sujoy.
On Friday, July 27, 2012 2:30:16 AM UTC+5:30, Joe Wong wrote:
Got it working, thanks Sujoy.
Would you know why the quantifier didn't work? I'm just wondering if there
is something wrong with my syntax
On Wednesday, July 25, 2012 11:21:27 AM UTC-4, Sujoy Sett wrote:
Hi,
Try using scripts. As following. They modify the field value before
applying faceting.
This is a copy from some stuff I was recently working with, so you need
to modify a bit to meet your details (fields and requirement).
Sujoy,
On Tuesday, July 24, 2012 9:17:34 PM UTC+5:30, Joe Wong wrote:
I have a field called createdDate of type string and it's not
analyzed. A sample entry for this field is "20120724120000"
I like to run facets on this field after a certain query and do a facet
count. However I want the facet to count based on a certain portion of the
field. I am using the regex option to this.
for example i have a few ES documents that contain:
20120724120000
20120724120001
20120724120002
20120725120021
20120726120034
i like facets to count 20120724 =t 3, 20120725 = 1, 20120726 = 1 etc.
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.