# Combination of Date Histogram Facet and Term Facet

(vijuitech) #1

Hi,
I am using DateHistogram Facet for getting the Daterange and
items. For Example

In DateHistogram Facet we can get the number of data or count
within the selected date range. In my application I need to get both
the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count similar to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How can I get this
using facet?

Cheers!

George

(vijuitech) #2

Hi,
How to combine two type of facets together as a single facet in
elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com wrote:

Hi,
I am using DateHistogram Facet for getting the Daterange and
items. For Example

In DateHistogram Facet we can get the number of data or count
within the selected date range. In my application I need to get both
the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count similar to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How can I get this
using facet?

Cheers!

George

(Igor Motov) #3

Not sure I understood your question. If you are trying to combine
statistical and histogram facets in the same facet, it's not possible.
However, you can send multiple facet requests in the same search request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}
}

On Saturday, April 21, 2012 7:41:22 AM UTC-4, George Viju wrote:

Hi,
How to combine two type of facets together as a single facet in
elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com wrote:

Hi,
I am using DateHistogram Facet for getting the Daterange and
items. For Example

In DateHistogram Facet we can get the number of data or count
within the selected date range. In my application I need to get both
the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count similar to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How can I get this
using facet?

Cheers!

George

(vijuitech) #4

Thank you Igor Motov! In my case, I need to combine the Date
Histogram and Term Facet

It is like.

1. Daterange and the count of matches similar to
createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}
2. The number number of items and the matches count similar to
"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

How can I combine these two as a single Facet?

Cheers!

George

On Apr 23, 8:30 pm, Igor Motov imo...@gmail.com wrote:

Not sure I understood your question. If you are trying to combine
statistical and histogram facets in the same facet, it's not possible.
However, you can send multiple facet requests in the same search request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}

}
On Saturday, April 21, 2012 7:41:22 AM UTC-4, George Viju wrote:

Hi,
How to combine two type of facets together as a single facet in
elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com wrote:

Hi,
I am using DateHistogram Facet for getting the Daterange and
items. For Example

In DateHistogram Facet we can get the number of data or count
within the selected date range. In my application I need to get both
the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count similar to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How can I get this
using facet?

Cheers!

George

(Igor Motov) #5

Your first example looks like statistical facet response, not
date histogram facet response. So, I am not quite sure what information you
are trying to retrieve. What's the type of the field that you are running
these facet queries on? Can you provide a more detailed example of what you
are trying to achieve?

On Monday, April 23, 2012 11:51:26 PM UTC-4, George Viju wrote:

Thank you Igor Motov! In my case, I need to combine the Date
Histogram and Term Facet

It is like.

1. Daterange and the count of matches similar to
createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}
2. The number number of items and the matches count similar to
"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

How can I combine these two as a single Facet?

Cheers!

George

On Apr 23, 8:30 pm, Igor Motov imo...@gmail.com wrote:

Not sure I understood your question. If you are trying to combine
statistical and histogram facets in the same facet, it's not possible.
However, you can send multiple facet requests in the same search
request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}

}
On Saturday, April 21, 2012 7:41:22 AM UTC-4, George Viju wrote:

Hi,
How to combine two type of facets together as a single facet in
elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com wrote:

Hi,
I am using DateHistogram Facet for getting the Daterange and
items. For Example

In DateHistogram Facet we can get the number of data or count
within the selected date range. In my application I need to get both
the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count similar to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How can I get this
using facet?

Cheers!

George

(vijuitech) #6

Thank You Igor Motov! . I have the parameters should be be found
like -- createddaterange vs sales and items (in the createddaterange)
vs sales ,

Here I need to find,

1. For each date range the number(amount) of sales.

2. For each items in the date range the number(amount) of sales.

Example:
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales is 25
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales of item AAA is 30

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the number of sales is 25 and the sales of item AAA is 30.

How can I get this using Facets Elasticsearch?

Cheers!

George

That is,

On Apr 24, 7:23 pm, Igor Motov imo...@gmail.com wrote:

Your first example looks like statistical facet response, not
date histogram facet response. So, I am not quite sure what information you
are trying to retrieve. What's the type of the field that you are running
these facet queries on? Can you provide a more detailed example of what you
are trying to achieve?

On Monday, April 23, 2012 11:51:26 PM UTC-4, George Viju wrote:

Thank you Igor Motov! In my case, I need to combine the Date
Histogram and Term Facet

It is like.

1. Daterange and the count of matches similar to
createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}
2. The number number of items and the matches count similar to
"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

How can I combine these two as a single Facet?

Cheers!

George

On Apr 23, 8:30 pm, Igor Motov imo...@gmail.com wrote:

Not sure I understood your question. If you are trying to combine
statistical and histogram facets in the same facet, it's not possible.
However, you can send multiple facet requests in the same search
request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}

}
On Saturday, April 21, 2012 7:41:22 AM UTC-4, George Viju wrote:

Hi,
How to combine two type of facets together as a single facet in
elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com wrote:

Hi,
I am using DateHistogram Facet for getting the Daterange and
items. For Example

In DateHistogram Facet we can get the number of data or count
within the selected date range. In my application I need to get both
the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count similar to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How can I get this
using facet?

Cheers!

George

(Igor Motov) #7

Are you going to have multiple ranges per request or a single range per
request?

On Tuesday, April 24, 2012 11:18:42 AM UTC-4, George Viju wrote:

Thank You Igor Motov! . I have the parameters should be be found
like -- createddaterange vs sales and items (in the createddaterange)
vs sales ,

Here I need to find,

1. For each date range the number(amount) of sales.

2. For each items in the date range the number(amount) of sales.

Example:
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales is 25
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales of item AAA is 30

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the number of sales is 25 and the sales of item AAA is 30.

How can I get this using Facets Elasticsearch?

Cheers!

George

That is,

On Apr 24, 7:23 pm, Igor Motov imo...@gmail.com wrote:

Your first example looks like statistical facet response, not
date histogram facet response. So, I am not quite sure what information
you
are trying to retrieve. What's the type of the field that you are
running
these facet queries on? Can you provide a more detailed example of what
you
are trying to achieve?

On Monday, April 23, 2012 11:51:26 PM UTC-4, George Viju wrote:

Thank you Igor Motov! In my case, I need to combine the Date
Histogram and Term Facet

It is like.

1. Daterange and the count of matches similar to
createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}
2. The number number of items and the matches count similar to
"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

How can I combine these two as a single Facet?

Cheers!

George

On Apr 23, 8:30 pm, Igor Motov imo...@gmail.com wrote:

Not sure I understood your question. If you are trying to combine
statistical and histogram facets in the same facet, it's not
possible.

However, you can send multiple facet requests in the same search
request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}

}
On Saturday, April 21, 2012 7:41:22 AM UTC-4, George Viju wrote:

Hi,
How to combine two type of facets together as a single facet
in

elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com wrote:

Hi,
I am using DateHistogram Facet for getting the Daterange
and

items. For Example

In DateHistogram Facet we can get the number of data or count
within the selected date range. In my application I need to get
both

the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count similar to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How can I get
this

using facet?

Cheers!

George

(vijuitech) #8

Thank You Igor Motov! Here I am using single date range per request.

Cheers!

George

On Apr 24, 9:00 pm, Igor Motov imo...@gmail.com wrote:

Are you going to have multiple ranges per request or a single range per
request?

On Tuesday, April 24, 2012 11:18:42 AM UTC-4, George Viju wrote:

Thank You Igor Motov! . I have the parameters should be be found
like -- createddaterange vs sales and items (in the createddaterange)
vs sales ,

Here I need to find,

1. For each date range the number(amount) of sales.
1. For each items in the date range the number(amount) of sales.

Example:
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales is 25
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales of item AAA is 30

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the number of sales is 25 and the sales of item AAA is 30.

How can I get this using Facets Elasticsearch?

Cheers!

George

That is,

On Apr 24, 7:23 pm, Igor Motov imo...@gmail.com wrote:

Your first example looks like statistical facet response, not
date histogram facet response. So, I am not quite sure what information
you
are trying to retrieve. What's the type of the field that you are
running
these facet queries on? Can you provide a more detailed example of what
you
are trying to achieve?

On Monday, April 23, 2012 11:51:26 PM UTC-4, George Viju wrote:

Thank you Igor Motov! In my case, I need to combine the Date
Histogram and Term Facet

It is like.

1. Daterange and the count of matches similar to
createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}
2. The number number of items and the matches count similar to
"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

How can I combine these two as a single Facet?

Cheers!

George

On Apr 23, 8:30 pm, Igor Motov imo...@gmail.com wrote:

Not sure I understood your question. If you are trying to combine
statistical and histogram facets in the same facet, it's not
possible.

However, you can send multiple facet requests in the same search
request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}

}
On Saturday, April 21, 2012 7:41:22 AM UTC-4, George Viju wrote:

Hi,
How to combine two type of facets together as a single facet
in

elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com wrote:

Hi,
I am using DateHistogram Facet for getting the Daterange
and

items. For Example

In DateHistogram Facet we can get the number of data or count
within the selected date range. In my application I need to get
both

the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count similar to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How can I get
this

using facet?

Cheers!

George

(Igor Motov) #9

I think I have started to understand what you are trying to achieve, but I
am still a little bit confused about "sale". In your example, for the same
period of time the total number of sales (25) is smaller than the number of
sales for one item (30). How is this possible and how are sales

On Tuesday, April 24, 2012 11:56:46 PM UTC-4, George Viju wrote:

Thank You Igor Motov! Here I am using single date range per request.

Cheers!

George

On Apr 24, 9:00 pm, Igor Motov imo...@gmail.com wrote:

Are you going to have multiple ranges per request or a single range per
request?

On Tuesday, April 24, 2012 11:18:42 AM UTC-4, George Viju wrote:

Thank You Igor Motov! . I have the parameters should be be found
like -- createddaterange vs sales and items (in the createddaterange)
vs sales ,

Here I need to find,

1. For each date range the number(amount) of sales.
1. For each items in the date range the number(amount) of sales.

Example:
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales is 25
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales of item AAA is 30

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the number of sales is 25 and the sales of item AAA is 30.

How can I get this using Facets Elasticsearch?

Cheers!

George

That is,

On Apr 24, 7:23 pm, Igor Motov imo...@gmail.com wrote:

Your first example looks like statistical facet response, not
date histogram facet response. So, I am not quite sure what
information

you

are trying to retrieve. What's the type of the field that you are
running
these facet queries on? Can you provide a more detailed example of
what

you

are trying to achieve?

On Monday, April 23, 2012 11:51:26 PM UTC-4, George Viju wrote:

Thank you Igor Motov! In my case, I need to combine the
Date

Histogram and Term Facet

It is like.

1. Daterange and the count of matches similar to
createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}
2. The number number of items and the matches count similar to
"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

How can I combine these two as a single Facet?

Cheers!

George

On Apr 23, 8:30 pm, Igor Motov imo...@gmail.com wrote:

Not sure I understood your question. If you are trying to
combine

statistical and histogram facets in the same facet, it's not
possible.

However, you can send multiple facet requests in the same search
request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}

}
On Saturday, April 21, 2012 7:41:22 AM UTC-4, George Viju wrote:

Hi,
How to combine two type of facets together as a single
facet

in

elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com wrote:

Hi,
I am using DateHistogram Facet for getting the
Daterange

and

items. For Example

In DateHistogram Facet we can get the number of data or
count

within the selected date range. In my application I need to
get

both

the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count similar
to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How can I
get

this

using facet?

Cheers!

George

(vijuitech) #10

I am sorry Igor Motov. Thanks for notifying this. Please read the
Example as:

`````` From  April 20, 2012 11:51:26 to  April 23, 2012 11:51:26  the
``````

number of sales is 30
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales of item AAA is 25

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the number of sales is 30 and the sales of item AAA is 25.

Cheers!

George

On Apr 25, 11:58 am, Igor Motov imo...@gmail.com wrote:

I think I have started to understand what you are trying to achieve, but I
am still a little bit confused about "sale". In your example, for the same
period of time the total number of sales (25) is smaller than the number of
sales for one item (30). How is this possible and how are sales

On Tuesday, April 24, 2012 11:56:46 PM UTC-4, George Viju wrote:

Thank You Igor Motov! Here I am using single date range per request.

Cheers!

George

On Apr 24, 9:00 pm, Igor Motov imo...@gmail.com wrote:

Are you going to have multiple ranges per request or a single range per
request?

On Tuesday, April 24, 2012 11:18:42 AM UTC-4, George Viju wrote:

Thank You Igor Motov! . I have the parameters should be be found
like -- createddaterange vs sales and items (in the createddaterange)
vs sales ,

Here I need to find,

1. For each date range the number(amount) of sales.
1. For each items in the date range the number(amount) of sales.

Example:
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales is 25
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales of item AAA is 30

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the number of sales is 25 and the sales of item AAA is 30.

How can I get this using Facets Elasticsearch?

Cheers!

George

That is,

On Apr 24, 7:23 pm, Igor Motov imo...@gmail.com wrote:

Your first example looks like statistical facet response, not
date histogram facet response. So, I am not quite sure what
information

you

are trying to retrieve. What's the type of the field that you are
running
these facet queries on? Can you provide a more detailed example of
what

you

are trying to achieve?

On Monday, April 23, 2012 11:51:26 PM UTC-4, George Viju wrote:

Thank you Igor Motov! In my case, I need to combine the
Date

Histogram and Term Facet

It is like.

1. Daterange and the count of matches similar to
createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}
2. The number number of items and the matches count similar to
"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

How can I combine these two as a single Facet?

Cheers!

George

On Apr 23, 8:30 pm, Igor Motov imo...@gmail.com wrote:

Not sure I understood your question. If you are trying to
combine

statistical and histogram facets in the same facet, it's not
possible.

However, you can send multiple facet requests in the same search
request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}

}
On Saturday, April 21, 2012 7:41:22 AM UTC-4, George Viju wrote:

Hi,
How to combine two type of facets together as a single
facet

in

elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com wrote:

Hi,
I am using DateHistogram Facet for getting the
Daterange

and

items. For Example

In DateHistogram Facet we can get the number of data or
count

within the selected date range. In my application I need to
get

both

the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count similar
to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How can I
get

this

using facet?

Cheers!

George

(Igor Motov) #11

In this case, all you need to do is to run terms facet with query that
limits results to your date range. The facets will contain number of sales
per term, and the total number of sales will be equal to total number of
hits.

{
.....
"hits" : {

• "total" : 7, <--- This is total number of records*
"max_score" : 1.0,
"hits" : [ ]
},
"facets" : {
"term" : {
"_type" : "terms",
"missing" : 0,
"total" : 7, <-- This is total number of terms, it will be equal to
the number above if you have one term per record
"other" : 0,
"terms" : [ {
"term" : "AAA",
"count" : 6
}, {
"term" : "BBB",
"count" : 1
} ]
}
}
}

On Wednesday, April 25, 2012 4:58:34 AM UTC-4, George Viju wrote:

I am sorry Igor Motov. Thanks for notifying this. Please read the
Example as:

`````` From  April 20, 2012 11:51:26 to  April 23, 2012 11:51:26  the
``````

number of sales is 30
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales of item AAA is 25

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the number of sales is 30 and the sales of item AAA is 25.

Cheers!

George

On Apr 25, 11:58 am, Igor Motov imo...@gmail.com wrote:

I think I have started to understand what you are trying to achieve, but
I
am still a little bit confused about "sale". In your example, for the
same
period of time the total number of sales (25) is smaller than the number
of
sales for one item (30). How is this possible and how are sales

On Tuesday, April 24, 2012 11:56:46 PM UTC-4, George Viju wrote:

Thank You Igor Motov! Here I am using single date range per request.

Cheers!

George

On Apr 24, 9:00 pm, Igor Motov imo...@gmail.com wrote:

Are you going to have multiple ranges per request or a single range
per

request?

On Tuesday, April 24, 2012 11:18:42 AM UTC-4, George Viju wrote:

Thank You Igor Motov! . I have the parameters should be be found
like -- createddaterange vs sales and items (in the
createddaterange)

vs sales ,

Here I need to find,

1. For each date range the number(amount) of sales.
1. For each items in the date range the number(amount) of sales.

Example:
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the

number of sales is 25
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the

number of sales of item AAA is 30

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012
11:51:26

the number of sales is 25 and the sales of item AAA is 30.

How can I get this using Facets Elasticsearch?

Cheers!

George

That is,

On Apr 24, 7:23 pm, Igor Motov imo...@gmail.com wrote:

Your first example looks like statistical facet response, not
date histogram facet response. So, I am not quite sure what
information

you

are trying to retrieve. What's the type of the field that you
are

running

these facet queries on? Can you provide a more detailed example
of

what

you

are trying to achieve?

On Monday, April 23, 2012 11:51:26 PM UTC-4, George Viju wrote:

Thank you Igor Motov! In my case, I need to combine the
Date

Histogram and Term Facet

It is like.

1. Daterange and the count of matches similar to
createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}
2. The number number of items and the matches count similar
to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

How can I combine these two as a single Facet?

Cheers!

George

On Apr 23, 8:30 pm, Igor Motov imo...@gmail.com wrote:

Not sure I understood your question. If you are trying to
combine

statistical and histogram facets in the same facet, it's not
possible.

However, you can send multiple facet requests in the same
search

request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}

}
On Saturday, April 21, 2012 7:41:22 AM UTC-4, George Viju
wrote:

Hi,
How to combine two type of facets together as a
single

facet

in

elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com
wrote:

Hi,
I am using DateHistogram Facet for getting the
Daterange

and

items. For Example

In DateHistogram Facet we can get the number of data
or

count

within the selected date range. In my application I need
to

get

both

the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count
similar

to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How can
I

get

this

using facet?

Cheers!

George

(vijuitech) #12

Thank you Igor Motov! Could it be possible for Multiple date ranges
per request (in the same Example)?

Cheers!

George
On Apr 25, 6:28 pm, Igor Motov imo...@gmail.com wrote:

In this case, all you need to do is to run terms facet with query that
limits results to your date range. The facets will contain number of sales
per term, and the total number of sales will be equal to total number of
hits.

{
.....
"hits" : {

• "total" : 7, <--- This is total number of records*
"max_score" : 1.0,
"hits" : [ ]
},
"facets" : {
"term" : {
"_type" : "terms",
"missing" : 0,
"total" : 7, <-- This is total number of terms, it will be equal to
the number above if you have one term per record
"other" : 0,
"terms" : [ {
"term" : "AAA",
"count" : 6
}, {
"term" : "BBB",
"count" : 1
} ]
}
}

}
On Wednesday, April 25, 2012 4:58:34 AM UTC-4, George Viju wrote:

I am sorry Igor Motov. Thanks for notifying this. Please read the
Example as:

`````` From  April 20, 2012 11:51:26 to  April 23, 2012 11:51:26  the
``````

number of sales is 30
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales of item AAA is 25

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the number of sales is 30 and the sales of item AAA is 25.

Cheers!

George

On Apr 25, 11:58 am, Igor Motov imo...@gmail.com wrote:

I think I have started to understand what you are trying to achieve, but
I
am still a little bit confused about "sale". In your example, for the
same
period of time the total number of sales (25) is smaller than the number
of
sales for one item (30). How is this possible and how are sales

On Tuesday, April 24, 2012 11:56:46 PM UTC-4, George Viju wrote:

Thank You Igor Motov! Here I am using single date range per request.

Cheers!

George

On Apr 24, 9:00 pm, Igor Motov imo...@gmail.com wrote:

Are you going to have multiple ranges per request or a single range
per

request?

On Tuesday, April 24, 2012 11:18:42 AM UTC-4, George Viju wrote:

Thank You Igor Motov! . I have the parameters should be be found
like -- createddaterange vs sales and items (in the
createddaterange)

vs sales ,

Here I need to find,

1. For each date range the number(amount) of sales.
1. For each items in the date range the number(amount) of sales.

Example:
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the

number of sales is 25
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the

number of sales of item AAA is 30

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012
11:51:26

the number of sales is 25 and the sales of item AAA is 30.

How can I get this using Facets Elasticsearch?

Cheers!

George

That is,

On Apr 24, 7:23 pm, Igor Motov imo...@gmail.com wrote:

Your first example looks like statistical facet response, not
date histogram facet response. So, I am not quite sure what
information

you

are trying to retrieve. What's the type of the field that you
are

running

these facet queries on? Can you provide a more detailed example
of

what

you

are trying to achieve?

On Monday, April 23, 2012 11:51:26 PM UTC-4, George Viju wrote:

Thank you Igor Motov! In my case, I need to combine the
Date

Histogram and Term Facet

It is like.

1. Daterange and the count of matches similar to
createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}
2. The number number of items and the matches count similar
to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

How can I combine these two as a single Facet?

Cheers!

George

On Apr 23, 8:30 pm, Igor Motov imo...@gmail.com wrote:

Not sure I understood your question. If you are trying to
combine

statistical and histogram facets in the same facet, it's not
possible.

However, you can send multiple facet requests in the same
search

request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}

}
On Saturday, April 21, 2012 7:41:22 AM UTC-4, George Viju
wrote:

Hi,
How to combine two type of facets together as a
single

facet

in

elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com
wrote:

Hi,
I am using DateHistogram Facet for getting the
Daterange

and

items. For Example

In DateHistogram Facet we can get the number of data
or

count

within the selected date range. In my application I need
to

get

both

the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count
similar

to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How can
I

get

this

using facet?

Cheers!

George

(Igor Motov) #13

I cannot think of any practical way to do it besides combining multiple
search requests into a single request using Multi Search API.

On Wednesday, April 25, 2012 9:44:49 AM UTC-4, George Viju wrote:

Thank you Igor Motov! Could it be possible for Multiple date ranges
per request (in the same Example)?

Cheers!

George
On Apr 25, 6:28 pm, Igor Motov imo...@gmail.com wrote:

In this case, all you need to do is to run terms facet with query that
limits results to your date range. The facets will contain number of
sales
per term, and the total number of sales will be equal to total number of
hits.

{
.....
"hits" : {

• "total" : 7, <--- This is total number of records*
"max_score" : 1.0,
"hits" : [ ]
},
"facets" : {
"term" : {
"_type" : "terms",
"missing" : 0,
"total" : 7, <-- This is total number of terms, it will be equal
to
the number above if you have one term per record
"other" : 0,
"terms" : [ {
"term" : "AAA",
"count" : 6
}, {
"term" : "BBB",
"count" : 1
} ]
}
}

}
On Wednesday, April 25, 2012 4:58:34 AM UTC-4, George Viju wrote:

I am sorry Igor Motov. Thanks for notifying this. Please read the
Example as:

`````` From  April 20, 2012 11:51:26 to  April 23, 2012 11:51:26  the
``````

number of sales is 30
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales of item AAA is 25

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the number of sales is 30 and the sales of item AAA is 25.

Cheers!

George

On Apr 25, 11:58 am, Igor Motov imo...@gmail.com wrote:

I think I have started to understand what you are trying to achieve,
but

I

am still a little bit confused about "sale". In your example, for
the

same

period of time the total number of sales (25) is smaller than the
number

of

sales for one item (30). How is this possible and how are sales

On Tuesday, April 24, 2012 11:56:46 PM UTC-4, George Viju wrote:

Thank You Igor Motov! Here I am using single date range per
request.

Cheers!

George

On Apr 24, 9:00 pm, Igor Motov imo...@gmail.com wrote:

Are you going to have multiple ranges per request or a single
range

per

request?

On Tuesday, April 24, 2012 11:18:42 AM UTC-4, George Viju wrote:

Thank You Igor Motov! . I have the parameters should be be
found

like -- createddaterange vs sales and items (in the
createddaterange)

vs sales ,

Here I need to find,

1. For each date range the number(amount) of sales.
1. For each items in the date range the number(amount) of
sales.

Example:
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the

number of sales is 25
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the

number of sales of item AAA is 30

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012
11:51:26

the number of sales is 25 and the sales of item AAA is 30.

How can I get this using Facets Elasticsearch?

Cheers!

George

That is,

On Apr 24, 7:23 pm, Igor Motov imo...@gmail.com wrote:

Your first example looks like statistical facet response,
not

date histogram facet response. So, I am not quite sure what
information

you

are trying to retrieve. What's the type of the field that
you

are

running

these facet queries on? Can you provide a more detailed
example

of

what

you

are trying to achieve?

On Monday, April 23, 2012 11:51:26 PM UTC-4, George Viju
wrote:

Thank you Igor Motov! In my case, I need to combine
the

Date

Histogram and Term Facet

It is like.

1. Daterange and the count of matches similar to
createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}
2. The number number of items and the matches count
similar

to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

How can I combine these two as a single Facet?

Cheers!

George

On Apr 23, 8:30 pm, Igor Motov imo...@gmail.com wrote:

Not sure I understood your question. If you are trying
to

combine

statistical and histogram facets in the same facet, it's
not

possible.

However, you can send multiple facet requests in the
same

search

request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}

}
On Saturday, April 21, 2012 7:41:22 AM UTC-4, George
Viju

wrote:

Hi,
How to combine two type of facets together as a
single

facet

in

elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com
wrote:

Hi,
I am using DateHistogram Facet for getting the
Daterange

and

items. For Example

In DateHistogram Facet we can get the number of
data

or

count

within the selected date range. In my application I
need

to

get

both

the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count
similar

to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How
can

I

get

this

using facet?

Cheers!

George

(vijuitech) #14

Thank You Igor Motov !

Cheers!

George

On Apr 25, 7:00 pm, Igor Motov imo...@gmail.com wrote:

I cannot think of any practical way to do it besides combining multiple
search requests into a single request using Multi Search API.

On Wednesday, April 25, 2012 9:44:49 AM UTC-4, George Viju wrote:

Thank you Igor Motov! Could it be possible for Multiple date ranges
per request (in the same Example)?

Cheers!

George
On Apr 25, 6:28 pm, Igor Motov imo...@gmail.com wrote:

In this case, all you need to do is to run terms facet with query that
limits results to your date range. The facets will contain number of
sales
per term, and the total number of sales will be equal to total number of
hits.

{
.....
"hits" : {

• "total" : 7, <--- This is total number of records*
"max_score" : 1.0,
"hits" : [ ]
},
"facets" : {
"term" : {
"_type" : "terms",
"missing" : 0,
"total" : 7, <-- This is total number of terms, it will be equal
to
the number above if you have one term per record
"other" : 0,
"terms" : [ {
"term" : "AAA",
"count" : 6
}, {
"term" : "BBB",
"count" : 1
} ]
}
}

}
On Wednesday, April 25, 2012 4:58:34 AM UTC-4, George Viju wrote:

I am sorry Igor Motov. Thanks for notifying this. Please read the
Example as:

`````` From  April 20, 2012 11:51:26 to  April 23, 2012 11:51:26  the
``````

number of sales is 30
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales of item AAA is 25

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the number of sales is 30 and the sales of item AAA is 25.

Cheers!

George

On Apr 25, 11:58 am, Igor Motov imo...@gmail.com wrote:

I think I have started to understand what you are trying to achieve,
but

I

am still a little bit confused about "sale". In your example, for
the

same

period of time the total number of sales (25) is smaller than the
number

of

sales for one item (30). How is this possible and how are sales

On Tuesday, April 24, 2012 11:56:46 PM UTC-4, George Viju wrote:

Thank You Igor Motov! Here I am using single date range per
request.

Cheers!

George

On Apr 24, 9:00 pm, Igor Motov imo...@gmail.com wrote:

Are you going to have multiple ranges per request or a single
range

per

request?

On Tuesday, April 24, 2012 11:18:42 AM UTC-4, George Viju wrote:

Thank You Igor Motov! . I have the parameters should be be
found

like -- createddaterange vs sales and items (in the
createddaterange)

vs sales ,

Here I need to find,

1. For each date range the number(amount) of sales.
1. For each items in the date range the number(amount) of
sales.

Example:
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the

number of sales is 25
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the

number of sales of item AAA is 30

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012
11:51:26

the number of sales is 25 and the sales of item AAA is 30.

How can I get this using Facets Elasticsearch?

Cheers!

George

That is,

On Apr 24, 7:23 pm, Igor Motov imo...@gmail.com wrote:

Your first example looks like statistical facet response,
not

date histogram facet response. So, I am not quite sure what
information

you

are trying to retrieve. What's the type of the field that
you

are

running

these facet queries on? Can you provide a more detailed
example

of

what

you

are trying to achieve?

On Monday, April 23, 2012 11:51:26 PM UTC-4, George Viju
wrote:

Thank you Igor Motov! In my case, I need to combine
the

Date

Histogram and Term Facet

It is like.

1. Daterange and the count of matches similar to
createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}
2. The number number of items and the matches count
similar

to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

How can I combine these two as a single Facet?

Cheers!

George

On Apr 23, 8:30 pm, Igor Motov imo...@gmail.com wrote:

Not sure I understood your question. If you are trying
to

combine

statistical and histogram facets in the same facet, it's
not

possible.

However, you can send multiple facet requests in the
same

search

request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}

}
On Saturday, April 21, 2012 7:41:22 AM UTC-4, George
Viju

wrote:

Hi,
How to combine two type of facets together as a
single

facet

in

elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com
wrote:

Hi,
I am using DateHistogram Facet for getting the
Daterange

and

items. For Example

In DateHistogram Facet we can get the number of
data

or

count

within the selected date range. In my application I
need

to

get

both

the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count
similar

to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {

...

(Shay Banon) #15

You can have multiple term facets, under their own name, each with a
facet_filter that further filter down the relevant term facet on a specific
date range.

On Wed, Apr 25, 2012 at 4:44 PM, George Viju vijuitech@gmail.com wrote:

Thank you Igor Motov! Could it be possible for Multiple date ranges
per request (in the same Example)?

Cheers!

George
On Apr 25, 6:28 pm, Igor Motov imo...@gmail.com wrote:

In this case, all you need to do is to run terms facet with query that
limits results to your date range. The facets will contain number of
sales
per term, and the total number of sales will be equal to total number of
hits.

{
.....
"hits" : {

• "total" : 7, <--- This is total number of records*
"max_score" : 1.0,
"hits" : [ ]
},
"facets" : {
"term" : {
"_type" : "terms",
"missing" : 0,
"total" : 7, <-- This is total number of terms, it will be equal
to
the number above if you have one term per record
"other" : 0,
"terms" : [ {
"term" : "AAA",
"count" : 6
}, {
"term" : "BBB",
"count" : 1
} ]
}
}

}
On Wednesday, April 25, 2012 4:58:34 AM UTC-4, George Viju wrote:

I am sorry Igor Motov. Thanks for notifying this. Please read the
Example as:

`````` From  April 20, 2012 11:51:26 to  April 23, 2012 11:51:26  the
``````

number of sales is 30
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26 the
number of sales of item AAA is 25

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the number of sales is 30 and the sales of item AAA is 25.

Cheers!

George

On Apr 25, 11:58 am, Igor Motov imo...@gmail.com wrote:

I think I have started to understand what you are trying to achieve,
but

I

am still a little bit confused about "sale". In your example, for the
same
period of time the total number of sales (25) is smaller than the
number

of

sales for one item (30). How is this possible and how are sales

On Tuesday, April 24, 2012 11:56:46 PM UTC-4, George Viju wrote:

Thank You Igor Motov! Here I am using single date range per
request.

Cheers!

George

On Apr 24, 9:00 pm, Igor Motov imo...@gmail.com wrote:

Are you going to have multiple ranges per request or a single
range

per

request?

On Tuesday, April 24, 2012 11:18:42 AM UTC-4, George Viju wrote:

Thank You Igor Motov! . I have the parameters should be be
found

like -- createddaterange vs sales and items (in the
createddaterange)

vs sales ,

Here I need to find,

1. For each date range the number(amount) of sales.
1. For each items in the date range the number(amount) of
sales.

Example:
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the

number of sales is 25
From April 20, 2012 11:51:26 to April 23, 2012 11:51:26
the

number of sales of item AAA is 30

My Output is Like
From April 20, 2012 11:51:26 to April 23, 2012
11:51:26

the number of sales is 25 and the sales of item AAA is 30.

How can I get this using Facets Elasticsearch?

Cheers!

George

That is,

On Apr 24, 7:23 pm, Igor Motov imo...@gmail.com wrote:

Your first example looks like statistical facet response, not
date histogram facet response. So, I am not quite sure what
information

you

are trying to retrieve. What's the type of the field that you
are

running

these facet queries on? Can you provide a more detailed
example

of

what

you

are trying to achieve?

On Monday, April 23, 2012 11:51:26 PM UTC-4, George Viju
wrote:

Thank you Igor Motov! In my case, I need to combine
the

Date

Histogram and Term Facet

It is like.

1. Daterange and the count of matches similar to
createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}
2. The number number of items and the matches count
similar

to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

How can I combine these two as a single Facet?

Cheers!

George

On Apr 23, 8:30 pm, Igor Motov imo...@gmail.com wrote:

Not sure I understood your question. If you are trying to
combine

statistical and histogram facets in the same facet, it's
not

possible.

However, you can send multiple facet requests in the same
search

request:

{
"query" : {
"match_all" : {}
},
"facets" : {
"stat1" : {
"statistical" : {
. . .
}
},
"histo1" : {
"date_histogram" : {
. . .
}
}
}

}
On Saturday, April 21, 2012 7:41:22 AM UTC-4, George Viju
wrote:

Hi,
How to combine two type of facets together as a
single

facet

in

elasticsearch?

Cheers!

George

On Apr 20, 7:46 pm, George Viju vijuit...@gmail.com
wrote:

Hi,
I am using DateHistogram Facet for getting the
Daterange

and

items. For Example

In DateHistogram Facet we can get the number of
data

or

count

within the selected date range. In my application I
need

to

get

both

the

1. Daterange and the count of matches similar to

createddate" : {
"_type" : "statistical",
"count" : 158,
"total" : 2.10720682311E14,
"min" : 1.3332708E12,
"max" : 1.3340484E12,
"mean" : 1.3336752045E12,
"sum_of_squares" : 2.8103295903276077E26,
"variance" : 6.30332803714792E16,
"std_deviation" : 2.510642952940127E8
}

1. The number number of items and the matches count
similar

to

"facets" : {
"itemscount" : {
"_type" : "terms",
"missing" : 0,
"total" : 3492,
"other" : 0,
"terms" : [ {
"term" : 1,
"count" : 3022
}, {
"term" : 2,
"count" : 247
}, {
"term" : 6,
"count" : 154
}, {
"term" : 3,
"count" : 28
}, {
"term" : 5,
"count" : 27
}, {
"term" : 4,
"count" : 14
} ]
},

Can this two things will get by a single facet? How
can

I

get

this

using facet?

Cheers!

George

(system) #16