SlideShare a Scribd company logo
1	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Real-­‐Time	
  Analy=cs	
  with	
  Solr	
  
Yonik	
  Seeley	
  
10/15/2015	
  
2	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
My	
  Background	
  
• Creator	
  of	
  Solr	
  
• Cloudera	
  Engineer	
  	
  
• LucidWorks	
  Co-­‐Founder	
  
• Lucene/Solr	
  commiMer,	
  PMC	
  member	
  
• Apache	
  SoQware	
  Founda=on	
  member	
  
• M.S.	
  in	
  Computer	
  Science,	
  Stanford	
  
3	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Solr	
  for	
  Analy=cs	
  
4	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Search	
  and	
  Hadoop	
  
•  Search	
  is	
  a	
  key	
  component	
  of	
  many	
  big	
  data	
  problems	
  
•  Many	
  analy=cs	
  use	
  cases	
  start	
  with	
  search	
  
•  Adding	
  analy=cs	
  to	
  full-­‐text	
  search	
  has	
  proven	
  to	
  be	
  more	
  effec=ve	
  than	
  
vice-­‐versa	
  
•  External	
  integra=ons	
  are	
  challenging	
  for	
  "real-­‐=me"	
  (i.e.	
  interac=ve)	
  
results	
  
	
  
	
  
5	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Solr	
  in	
  Hadoop	
  
	
  
•  Top	
  Hadoop	
  vendors	
  who	
  have	
  integrated	
  search	
  have	
  all	
  chosen	
  Apache	
  Solr	
  
• For	
  example:	
  Cloudera,	
  Hortonworks,	
  MapR,	
  IBM,	
  ...	
  
•  Historical	
  focus	
  on	
  interac=ve	
  response	
  =mes	
  
•  Historical	
  focus	
  on	
  faceted	
  search	
  /	
  guided	
  naviga=on	
  
•  High	
  performance	
  indexes	
  
• originally	
  for	
  "full-­‐text"	
  search,	
  but	
  just	
  as	
  great	
  for	
  meta-­‐data!	
  
6	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Inverted	
  Index	
  
aardvark	
  
hood	
  
red	
  
liMle	
  
riding	
  
robin	
  
women	
  
zoo	
  
LiMle	
  Red	
  Riding	
  Hood	
  
Robin	
  Hood	
  
LiMle	
  Women	
  
0	
   1	
  
0	
   2	
  
0	
  
0	
  
2	
  
1	
  
0	
  
1	
  
2	
  
Documents	
  
7	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Columnar	
  Storage	
  (DocValues)	
  
a1	
  
a2	
  
a3	
  
a4	
  
b1	
  
b2	
  
b3	
  
b4	
  
c1	
  
c2	
  
c3	
  
c4	
  
a1	
   b1	
   c1	
  a3	
   b3	
   c3	
  
Stored	
  Fields	
  
(row	
  oriented)	
  
DocValues	
  
(column	
  oriented)	
  
a1	
   b1	
   c1	
  a1	
   b1	
   c1	
   ...	
   a1	
   b1	
   c1	
  a2	
   b2	
   c3	
   ...	
  
•  Fast	
  linear	
  scan	
  
• Read	
  only	
  the	
  data	
  you	
  need	
  
•  Fast	
  random	
  access	
  
• docid	
  -­‐>	
  value(s)	
  
•  High	
  degree	
  of	
  locality	
  
•  Compressed	
  
• prefix,	
  delta,	
  table,	
  gcd,	
  etc	
  
•  Mostly	
  "Off-­‐Heap"	
  
• Memory	
  mapped	
  from	
  index	
  
•  Row	
  vs	
  Column	
  configurable	
  per	
  field!	
  
8	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Mul=-­‐Segment	
  Index	
  
_0.fnm	
  
_0.fdt	
  
_0.fdx	
  
[...]	
  
_0_1.del	
   _1.fnm	
  
_1.fdt	
  
_1.fdx	
  
[…]	
  
segments_3	
  
•  Each	
  segment	
  is	
  a	
  self-­‐contained	
  "index"	
  
•  Segments	
  are	
  never	
  changed	
  once	
  wriMen	
  
•  Per-­‐segment	
  caching	
  very	
  effec=ve	
  
•  Point-­‐in-­‐=me	
  searcher	
  
•  gejng	
  new	
  view	
  means	
  wri=ng	
  &	
  
including	
  addi=onal	
  segment	
  
•  turns	
  a	
  weakness	
  into	
  a	
  strength	
  
9	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Faceted	
  Search	
  
•  Breaks	
  search	
  results	
  into	
  
buckets	
  
•  Generally	
  provides	
  bucket	
  
counts	
  
•  Allows	
  user	
  to	
  filter	
  /	
  "drill	
  
into"	
  results	
  
10	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
New	
  Facet	
  Module	
  
11	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Face=ng	
  
Search	
  
Sta=s=cs	
  
Facet	
  Module	
  Goals	
  
Search	
  
Joins	
  
Grouping	
  
Field	
  
Collapsing	
  
New	
  Facet	
  Module	
  
JSON	
  Facet	
  API	
  
•  Integra=on	
  
•  Performance	
  
•  Ease	
  of	
  use	
  
Highligh=ng	
  
Nested	
  
Documents	
  
Geosearch	
  
12	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Slice	
  and	
  Dice	
  with	
  Facet	
  commands	
  
Domain	
  
Facet	
  
Command	
  
A	
  
•  Domain:	
  A	
  set	
  of	
  documents	
  
•  Facet	
  command:	
  create	
  sub-­‐domains	
  /	
  "facet	
  buckets"	
  
Facet	
  
Command	
  
B	
  
Domain	
  
Domain	
  
Domain	
  
Domain	
  
Facet	
  
Command	
  
C	
  
Domain	
  
Domain	
  
Domain	
  
Domain	
  
Domain	
  
Domain	
  
13	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Facet	
  Func=ons	
  /	
  Sta=s=cs	
  
Domain	
  
Facet	
  
Command	
  
A	
  
Facet	
  
Command	
  
B	
  
Domain	
  
Domain	
  
Domain	
  
Domain	
  
Facet	
  
Command	
  
C	
  
Domain	
  
Domain	
  
Domain	
  
Domain	
  
Domain	
  
Domain	
  
sum(x)	
  
unique(y)	
  
sum(x)	
  
unique(y)	
  
sum(x)	
  
unique(y)	
  
min(units)	
  
avg(price)	
  
•  Facet	
  func=on	
  calculates	
  something	
  over	
  a	
  domain	
  
•  Can	
  sort	
  domains	
  by	
  facet	
  func=ons!	
  
14	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Facet	
  func=ons	
  
•  Calculate	
  (and	
  Sort)	
  by	
  things	
  other	
  than	
  document	
  count	
  
Func%on	
   Example	
   Descrip%on	
  
sum	
   sum(sales)	
   Summa=on	
  of	
  numeric	
  values	
  
avg	
   avg(popularity)	
   Average	
  of	
  numeric	
  values	
  	
  
sumsq	
   sumsq(rent)	
   Sum	
  of	
  squares	
  
min	
   min(salary)	
   Minimum	
  value	
  
max	
   max(mul(popularity,boost))	
   Maximum	
  value	
  
unique	
   unique(state)	
   Number	
  of	
  unique	
  values	
  (calc	
  dis=nct)	
  
hll	
   hll(state)	
   Number	
  of	
  unique	
  values	
  using	
  HyperLogLog	
  algorithm	
  
percen=le	
   percen=le(salary,	
  25,	
  50,	
  75)	
   Calculates	
  percen=les	
  via	
  t-­‐digest	
  algorithm	
  
topdocs	
   topdocs("another	
  query",5)	
   (in	
  progress)	
  Returns	
  the	
  top	
  documents	
  for	
  another	
  query	
  
15	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Simple	
  request	
  and	
  response	
  
curl	
  http://localhost:8983/solr/query	
  -­‐d	
  '	
  
q=widgets&	
  
json.facet=	
  
{	
  
	
  	
  x	
  :	
  "avg(price)"	
  ,	
  	
  
	
  	
  y	
  :	
  "unique(brand)"	
  
}	
  
'	
  
	
  
[…]	
  
"facets"	
  :	
  {	
  
	
  	
  "count"	
  :	
  314,	
  
	
  	
  "x"	
  :	
  102.5,	
  
	
  	
  "y"	
  :	
  28	
  
}	
  
root	
  domain	
  defined	
  by	
  docs	
  
matching	
  the	
  query	
   count	
  of	
  docs	
  in	
  the	
  bucket	
  
16	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
All-­‐JSON	
  request	
  example	
  
$	
  curl	
  http://localhost:8983/solr/query	
  -­‐d	
  '	
  
{	
  
	
  	
  query	
  :	
  "widgets", 	
   	
   	
   	
  //	
  our	
  JSON	
  parser	
  accepts	
  comments	
  (C-­‐style	
  too)	
  
	
  	
  filter	
  :	
  "inStock:true",	
   	
   	
  //	
  bare	
  strings	
  can	
  appear	
  unquoted	
  
	
  	
  offset:	
  0,	
  
	
  	
  limit:	
  5,	
  
	
  	
  sort:	
  "price	
  desc",	
  
	
  	
  fields:	
  ["id","name","price"],	
   	
  /*	
  could	
  have	
  also	
  used	
  "id,name,price"	
  */	
  
	
  	
  facet	
  :	
  {	
  
	
  	
  	
  	
  x	
  :	
  "avg(price)",	
  
	
  	
  	
  	
  y	
  :	
  "unique(brand)"	
  
	
  	
  }	
  
}	
  
'	
  
17	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Bucke=ng	
  Facet	
  Types	
  
•  Terms	
  Facet	
  
• Creates	
  new	
  domains	
  (facet	
  buckets)	
  based	
  on	
  values	
  in	
  a	
  field	
  
•  Range	
  Facet	
  
• Creates	
  mul=ple	
  buckets	
  based	
  on	
  date	
  ranges	
  or	
  numeric	
  ranges	
  
•  Query	
  Facet	
  
• Creates	
  a	
  single	
  bucket	
  of	
  documents	
  that	
  match	
  any	
  given	
  query	
  
•  Unlimited	
  nes=ng:	
  Any	
  facet	
  types	
  may	
  have	
  any	
  number	
  of	
  sub-­‐facets	
  
18	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Terms	
  facet	
  example	
  
	
  json.facet={	
  
	
  	
  	
  shoes	
  :	
  {	
  
	
  	
  	
  	
  	
  type	
  :	
  terms,	
  	
  
	
  	
  	
  	
  	
  field	
  :	
  shoe_style,	
  
	
  	
  	
  	
  	
  sort	
  :	
  {x	
  :	
  desc},	
  
	
  	
  	
  	
  	
  facet	
  :	
  {	
  
	
  	
  	
  	
  	
  	
  	
  x	
  :	
  "avg(price)",	
  
	
  	
  	
  	
  	
  	
  	
  y	
  :	
  "unique(brand)"	
  
	
  	
  	
  	
  	
  }	
  
	
  	
  	
  }	
  
	
  }	
  
"facets":	
  {	
  
	
  	
  "count"	
  :	
  472,	
  
	
  	
  "shoes":	
  {	
  
	
  	
  	
  	
  "buckets"	
  :	
  [	
  
	
  	
  	
  	
  	
  	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  "val"	
  :	
  "Hiking",	
  
	
  	
  	
  	
  	
  	
  	
  	
  "count"	
  :	
  34,	
  
	
  	
  	
  	
  	
  	
  	
  	
  "x"	
  :	
  135.25,	
  
	
  	
  	
  	
  	
  	
  	
  	
  "y"	
  :	
  17,	
  
	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  "val"	
  :	
  "Running",	
  
	
  	
  	
  	
  	
  	
  	
  	
  "count"	
  :	
  45,	
  
	
  	
  	
  	
  	
  	
  	
  	
  "x"	
  :	
  110.75,	
  
	
  	
  	
  	
  	
  	
  	
  	
  "y"	
  :	
  24,	
  
	
  	
  	
  	
  	
  	
  },	
  
	
  
Calculated	
  per-­‐bucket	
  
19	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Sub-­‐facet	
  example	
  
	
  json.facet={	
  
	
  	
  	
  shoes:{	
  
	
  	
  	
  	
  	
  type	
  :	
  terms,	
  
	
  	
  	
  	
  	
  field	
  :	
  shoe_style,	
  
	
  	
  	
  	
  	
  sort	
  :	
  {x	
  :	
  desc},	
  
	
  	
  	
  	
  	
  facet	
  :	
  {	
  
	
  	
  	
  	
  	
  	
  	
  x	
  :	
  "avg(price)",	
  
	
  	
  	
  	
  	
  	
  	
  y	
  :	
  "unique(brand)",	
  
	
  	
  	
  	
  	
  	
  	
  colors	
  :	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  type	
  :	
  terms,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  field	
  :	
  color	
  
	
  	
  	
  	
  	
  	
  	
  }	
  	
  
	
  	
  	
  	
  	
  }	
  
	
  	
  	
  }	
  
	
  }	
  
"facets":	
  {	
  
	
  	
  "count"	
  :	
  472,	
  
	
  	
  "shoes":	
  {	
  
	
  	
  	
  	
  "buckets"	
  :	
  [	
  
	
  	
  	
  	
  	
  	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  "val"	
  :	
  "Hiking",	
  
	
  	
  	
  	
  	
  	
  	
  	
  "count"	
  :	
  34,	
  
	
  	
  	
  	
  	
  	
  	
  	
  "x"	
  :	
  135.25,	
  
	
  	
  	
  	
  	
  	
  	
  	
  "y"	
  :	
  17,	
  
	
  	
  	
  	
  	
  	
  	
  	
  "colors"	
  :	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  "buckets"	
  :	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {	
  "val"	
  :	
  "brown",	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  "count"	
  :	
  12	
  },	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {	
  "val"	
  :	
  "black",	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  "count"	
  :	
  10	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  },	
  […]	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ]	
  
	
  	
  	
  	
  	
  	
  	
  	
  }	
  //	
  end	
  of	
  colors	
  sub-­‐facet	
  
	
  	
  	
  	
  	
  	
  },	
  //	
  end	
  of	
  Hiking	
  bucket	
  
	
  	
  	
  	
  	
  	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  "val"	
  :	
  "Running",	
  
	
  	
  	
  	
  	
  	
  	
  	
  "count"	
  :	
  45,	
  
	
  	
  	
  	
  	
  	
  	
  	
  "x"	
  :	
  110.75,	
  
	
  	
  	
  	
  	
  	
  	
  	
  "y"	
  :	
  24,	
  
	
  	
  	
  	
  	
  	
  	
  	
  "colors"	
  :	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  "buckets"	
  :	
  […]	
  
20	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
BI	
  Usecase	
  
21	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Fantasy	
  ($1045)	
  
	
  
Top	
  Authors	
  
$423	
  George	
  R.R.	
  Mar=n	
  
$347	
  Brandon	
  Sanderson	
  
$155	
  JK	
  Rowling	
  
	
  
Top	
  Books	
  
$252	
  A	
  Game	
  of	
  Thrones	
  
$113	
  Emperor	
  of	
  Thorns	
  
$101	
  Nine	
  Princes	
  in	
  Amber	
  
$82	
  	
  	
  Steel	
  Heart	
  
Sci-­‐Fi	
  ($898)	
  
	
  
Top	
  Authors	
  
$321	
  Iain	
  M	
  Banks	
  
$218	
  Neal	
  Asher	
  
$155	
  Neal	
  Stephenson	
  
	
  
Top	
  Books	
  
$113	
  Gridlinked	
  
$101	
  Use	
  of	
  Weapons	
  
$93	
  	
  	
  Snow	
  Crash	
  
$82	
  	
  	
  The	
  Skinner	
  
Mystery	
  ($645)	
  
	
  
Top	
  Authors	
  
$191	
  James	
  PaMerson	
  
$145	
  Patricia	
  Cornwell	
  
$126	
  John	
  Grisham	
  
	
  
Top	
  Books	
  
$85	
  	
  One	
  for	
  the	
  Money	
  
$77	
  	
  Angels	
  &	
  Daemons	
  
$64	
  	
  ShuMer	
  Island	
  
$35	
  	
  The	
  Firm	
  
Filter	
  By	
  
State	
  
$852	
  NJ	
  	
  	
  (14	
  stores)	
  
$658	
  NY	
  	
  (11	
  stores)	
  
$421	
  CT	
  	
  	
  (8	
  stores)	
  
	
  
Chain	
  
$984	
  Amazoon	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  (14	
  stores)	
  
$734	
  Houses&Royalty	
  (9	
  stores)	
  
$387	
  Books-­‐r-­‐us	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  (7	
  stores)	
  
	
  
Store	
  
$108	
  Amazoon	
  Branchburg	
  
$93	
  	
  	
  Books-­‐r-­‐us	
  Bridgewater	
  
$87	
  	
  	
  H&R	
  NYC	
  
	
  
	
  
	
  
Number	
  of	
  Books	
  
	
  
Chain	
  
201K	
  Houses&Royalty	
  
183K	
  Amazoon	
  
98K	
  	
  	
  Books-­‐r-­‐us	
  
	
  
Store	
  
193K	
  H&R	
  NYC	
  
77K	
  	
  	
  Books-­‐r-­‐us	
  Bridgewater	
  
68K	
  	
  	
  Amazoon	
  Branchburg	
  
	
  
22	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
date_breakout	
  :	
  {	
  
	
  	
  	
  type	
  :	
  range,	
  
	
  	
  	
  field	
  :	
  sale_date,	
  
	
  	
  	
  start	
  :	
  ...,	
  
	
  	
  	
  end	
  :	
  ...,	
  
	
  	
  	
  gap	
  :	
  "+1MONTH”,	
  
	
  
	
  	
  facet	
  :	
  {	
  	
  
	
  	
  	
  	
  	
  	
  	
  top_genres	
  :	
  {	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  type	
  :	
  terms	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  field	
  :	
  genre,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sort	
  :	
  "revenue	
  desc",	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  limit	
  :	
  4,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  facet	
  :	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  revenue	
  :	
  "sum(sales)"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  by_chain:	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  type	
  :	
  terms,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  field	
  :	
  chain,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  facet	
  :	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  revenue	
  :	
  "sum(sales)"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  }	
  
Implementa=on	
  
Range	
  Facet	
  
(sale_date)	
  
Terms	
  Facet	
  
(genre)	
  
Terms	
  Facet	
  
(chain)	
  
sum(sales)	
  
sum(sales)	
  
23	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Fantasy	
  ($1045)	
  
	
  
Top	
  Authors	
  
$423	
  George	
  R.R.	
  Mar=n	
  
$347	
  Brandon	
  Sanderson	
  
$155	
  JK	
  Rowling	
  
	
  
Top	
  Books	
  
$252	
  A	
  Game	
  of	
  Thrones	
  
$113	
  Emperor	
  of	
  Thorns	
  
$101	
  Nine	
  Princes	
  in	
  Amber	
  
$82	
  	
  	
  Steel	
  Heart	
  
Sci-­‐Fi	
  ($898)	
  
	
  
Top	
  Authors	
  
$321	
  Iain	
  M	
  Banks	
  
$218	
  Neal	
  Asher	
  
$155	
  Neal	
  Stephenson	
  
	
  
Top	
  Books	
  
$113	
  Gridlinked	
  
$101	
  Use	
  of	
  Weapons	
  
$93	
  	
  	
  Snow	
  Crash	
  
$82	
  	
  	
  The	
  Skinner	
  
Mystery	
  ($645)	
  
	
  
Top	
  Authors	
  
$191	
  James	
  PaMerson	
  
$145	
  Patricia	
  Cornwell	
  
$126	
  John	
  Grisham	
  
	
  
Top	
  Books	
  
$85	
  	
  One	
  for	
  the	
  Money	
  
$77	
  	
  Angels	
  &	
  Daemons	
  
$64	
  	
  ShuMer	
  Island	
  
$35	
  	
  The	
  Firm	
  
top_genres:{	
  
	
  	
  	
  	
  type	
  :	
  terms,	
  
	
  	
  	
  	
  field	
  :	
  genre,	
  
	
  	
  	
  	
  facet	
  :	
  {	
  
	
  	
  	
  	
  	
  	
  	
  rev	
  :	
  "sum(sales)",	
  
	
  	
  	
  	
  	
  	
  	
  top_authors:{	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  type	
  :	
  terms,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  field	
  :	
  author,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  sort	
  	
  :"rev	
  desc",	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  limit	
  :	
  3,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  facet	
  :	
  {	
  rev	
  :	
  "sum(sales)"	
  }	
  
	
  	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  	
  top_books:{	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  type	
  :	
  terms,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  field	
  :	
  =tle,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  sort	
  	
  :	
  "rev	
  desc",	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  limit	
  :	
  4,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  facet	
  :	
  {	
  rev	
  :	
  "sum(sales)"	
  }	
  
	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  }	
  
Implementa=on	
  (con=nued)	
  
Terms	
  Facet	
  
(genre)	
  
Terms	
  Facet	
  
(author)	
  
Terms	
  Facet	
  
(=tle)	
  
sum(sales)	
  
sum(sales)	
  
sum(sales)	
  
24	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Performance	
  
25	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
facet=true&stats=true	
  
&stats.field={!tag=stat1+mean=true}field2	
  
&facet.pivot={!stats=stat1}field1	
  
&f.field1.limit=10	
  
json.facet={	
  
	
  	
  	
  	
  f	
  :	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  type	
  :	
  terms,	
  
	
  	
  	
  	
  	
  	
  	
  	
  field	
  :	
  field1,	
  
	
  	
  	
  	
  	
  	
  	
  	
  facet:{	
  mean:"avg(field2)"	
  }	
  
	
  	
  	
  	
  }	
  
}	
  
Tested	
  Facet	
  Request	
  
Legacy
(stats component & pivot facets)
JSON Facet API
(New Facet Module)
26	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
27	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
28	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Nested	
  Documents	
  
29	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Indexing	
  Nested	
  Documents	
  
id	
  :	
  book1	
  
=tle	
  :	
  The	
  Way	
  of	
  Kings	
  
author	
  :	
  Brandon	
  Sanderson	
  
id	
  :	
  book1_review1	
  
review_author	
  :	
  Yonik	
  
stars	
  :	
  5	
  
comment	
  :	
  A	
  great	
  start	
  to	
  what	
  ...	
  
id	
  :	
  book1_review2	
  
review_author	
  :	
  Dan	
  
stars	
  :	
  3	
  
comment	
  :	
  This	
  book	
  was	
  too	
  long	
  
id	
  :	
  book2	
  
=tle	
  :	
  Snow	
  Crash	
  
author	
  :	
  Neal	
  Stephenson	
  
id	
  :	
  book2_review1	
  
review_author	
  :	
  Yonik	
  
stars	
  :	
  5	
  
comment	
  :	
  Ahead	
  of	
  it's	
  =me	
  ...	
  
book1_review1	
  
book1_review2	
  
book1	
  
book2_review1	
  
book2	
  
Lucene	
  index	
  view	
  (flat)	
  
•  Group	
  indexed	
  as	
  a	
  "block"	
  
•  atomic	
  
•  internal	
  document	
  ids	
  con=guous	
  
•  enables	
  quick	
  and	
  inexpensive	
  joins	
  
30	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Indexing	
  Nested	
  Documents	
  (JSON	
  format)	
  
{	
  	
  id	
  :	
  book1,	
  	
  type	
  :	
  book,	
  	
  =tle	
  :	
  "The	
  Way	
  of	
  Kings",	
  	
  author	
  :	
  "Brandon	
  Sanderson",	
  
	
  	
  	
  genre	
  :	
  fantasy,	
  	
  pubyear	
  :	
  2010,	
  	
  publisher	
  :	
  Tor,	
  
	
  	
  _childDocuments_	
  :	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  {	
  	
  id	
  :	
  book1_review1,	
  	
  type	
  :	
  review,	
  	
  review_dt:"2015-­‐01-­‐03T14:30:00Z",	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  stars	
  :	
  5,	
  	
  review_author	
  :	
  Yonik,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  comment	
  :	
  "A	
  great	
  start	
  to	
  what	
  looks	
  like	
  an	
  epic	
  series!"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  ,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  {	
  	
  id	
  :	
  book1_review2,	
  	
  type	
  :	
  review,	
  	
  review_dt:"2015-­‐03-­‐15T12:00:00Z",	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  stars	
  :	
  3,	
  review_author	
  :	
  Dan,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  comment	
  :	
  "This	
  book	
  was	
  too	
  long."	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  ]	
  
	
  }	
  
31	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Block	
  Join	
  Queries	
  
Find	
  reviews	
  men=oning	
  "epic",	
  limi=ng	
  to	
  reviews	
  for	
  books	
  published	
  by	
  Tor	
  
	
  
	
  
	
  
	
  
	
  
Find	
  books	
  published	
  by	
  Tor	
  with	
  a	
  review	
  men=oning	
  "epic"	
  
	
  q=comment:epic	
  
	
  fq={!child	
  of="type:book"}publisher:Tor	
  
	
  sort=review_dt	
  desc	
  
	
  q=publisher:Tor	
  
	
  fq={!parent	
  which="type:book"}comment:epic	
  
	
  sort=pubyear	
  desc	
  
32	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Block	
  Join	
  Face=ng	
  (child	
  to	
  parent)	
  
	
  
•  Find	
  the	
  number	
  of	
  books	
  I	
  (Yonik)	
  reviewed,	
  broken	
  out	
  by	
  Genre	
  
q=review_author:Yonik&	
  
json.facet={	
  
	
  	
  	
  	
  genres	
  :	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  type	
  :	
  terms,	
  
	
  	
  	
  	
  	
  	
  	
  	
  field	
  :	
  genre,	
  
	
  	
  	
  	
  	
  	
  	
  	
  domain	
  :	
  {	
  blockParent	
  :	
  "type:book"	
  }	
  	
  
	
  	
  	
  	
  }	
  
}	
  
33	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Block	
  Join	
  Face=ng	
  (parent	
  to	
  child)	
  
	
  
•  Find	
  the	
  top	
  reviewers	
  for	
  sci-­‐fi	
  and	
  fantasy	
  books	
  
q=genre:(sci-­‐fi	
  OR	
  fantasy)&	
  
json.facet={	
  
	
  	
  	
  	
  top_reviewers	
  :	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  type:	
  terms,	
  
	
  	
  	
  	
  	
  	
  	
  	
  field:	
  review_author,	
  
	
  	
  	
  	
  	
  	
  	
  	
  domain:	
  {	
  blockChildren	
  :	
  "type:book"	
  }	
  	
  
	
  	
  	
  	
  }	
  
}	
  
34	
  ©	
  Cloudera,	
  Inc.	
  All	
  rights	
  reserved.	
  
Thank	
  you	
  
yonik@cloudera.com	
  

More Related Content

PDF
Search Analytics Component: Presented by Steven Bower, Bloomberg L.P.
PDF
The Evolution of Streaming Expressions - Joel Bernstein, Alfresco & Dennis Go...
PDF
Deduplication Using Solr: Presented by Neeraj Jain, Stubhub
PDF
Parallel SQL and Analytics with Solr: Presented by Yonik Seeley, Cloudera
PDF
Parallel SQL and Streaming Expressions in Apache Solr 6
PDF
Building a real time big data analytics platform with solr
PPTX
OrientDB vs Neo4j - Comparison of query/speed/functionality
PDF
Solr JDBC: Presented by Kevin Risden, Avalon Consulting
Search Analytics Component: Presented by Steven Bower, Bloomberg L.P.
The Evolution of Streaming Expressions - Joel Bernstein, Alfresco & Dennis Go...
Deduplication Using Solr: Presented by Neeraj Jain, Stubhub
Parallel SQL and Analytics with Solr: Presented by Yonik Seeley, Cloudera
Parallel SQL and Streaming Expressions in Apache Solr 6
Building a real time big data analytics platform with solr
OrientDB vs Neo4j - Comparison of query/speed/functionality
Solr JDBC: Presented by Kevin Risden, Avalon Consulting

What's hot (20)

PDF
Webinar: Solr 6 Deep Dive - SQL and Graph
PDF
OLAP Battle - SolrCloud vs. HBase: Presented by Dragan Milosevic, Zanox AG
PDF
Building a Real-Time News Search Engine: Presented by Ramkumar Aiyengar, Bloo...
PDF
Data Science with Solr and Spark
PDF
H-Hypermap - Heatmap Analytics at Scale: Presented by David Smiley, D W Smile...
PDF
Designing and Building a Graph Database Application – Architectural Choices, ...
PDF
SQL Now! How Optiq brings the best of SQL to NoSQL data.
PDF
Beyond SQL: Speeding up Spark with DataFrames
PDF
Webinar: Replace Google Search Appliance with Lucidworks Fusion
PDF
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
PDF
Cost-based Query Optimization in Apache Phoenix using Apache Calcite
PDF
Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...
PPT
SQL on Big Data using Optiq
PDF
Apache Calcite Tutorial - BOSS 21
PPTX
Advanced Apache Spark Meetup Spark SQL + DataFrames + Catalyst Optimizer + Da...
PDF
Cost-based Query Optimization
PPTX
Discardable In-Memory Materialized Queries With Hadoop
PPT
Why is data independence (still) so important? Optiq and Apache Drill.
PDF
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...
PDF
Journey of Implementing Solr at Target: Presented by Raja Ramachandran, Target
Webinar: Solr 6 Deep Dive - SQL and Graph
OLAP Battle - SolrCloud vs. HBase: Presented by Dragan Milosevic, Zanox AG
Building a Real-Time News Search Engine: Presented by Ramkumar Aiyengar, Bloo...
Data Science with Solr and Spark
H-Hypermap - Heatmap Analytics at Scale: Presented by David Smiley, D W Smile...
Designing and Building a Graph Database Application – Architectural Choices, ...
SQL Now! How Optiq brings the best of SQL to NoSQL data.
Beyond SQL: Speeding up Spark with DataFrames
Webinar: Replace Google Search Appliance with Lucidworks Fusion
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Cost-based Query Optimization in Apache Phoenix using Apache Calcite
Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...
SQL on Big Data using Optiq
Apache Calcite Tutorial - BOSS 21
Advanced Apache Spark Meetup Spark SQL + DataFrames + Catalyst Optimizer + Da...
Cost-based Query Optimization
Discardable In-Memory Materialized Queries With Hadoop
Why is data independence (still) so important? Optiq and Apache Drill.
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...
Journey of Implementing Solr at Target: Presented by Raja Ramachandran, Target
Ad

Viewers also liked (20)

PDF
Visualize Solr Data with Banana: Presented by Andrew Thanalertvisuti, Lucidworks
PDF
Solr for Analytics
PDF
Large Scale ETL for Hadoop and Cloudera Search using Morphlines
PPTX
Webinar Google Analytics Real Time MA 22-11-11
PPTX
Real-Time Big Data with Storm, Kafka and GigaSpaces
PDF
Cloudera Search Webinar: Big Data Search, Bigger Insights
PDF
Never Stop Exploring - Pushing the Limits of Solr: Presented by Anirudha Jadh...
PDF
Build a Great Application in Minutes!: Presented by Stefan Olafsson, Twigkit
PDF
Semantic & Multilingual Strategies in Lucene/Solr: Presented by Trey Grainger...
PDF
Webinar: Simpler Semantic Search with Solr
PDF
Large Scale Crawling with Apache Nutch and Friends
PDF
Webinar: Natural Language Search with Solr
PDF
Using Morphlines for On-the-Fly ETL
PDF
A Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
PDF
Galene - LinkedIn's Search Architecture: Presented by Diego Buthay & Sriram S...
PDF
How We Used Cassandra/Solr to Build Real-Time Analytics Platform
PDF
Nested Types in Impala
PDF
Webinar: What's New in Solr 6
PDF
Natural Language Search in Solr
PDF
Airbnb Search Architecture: Presented by Maxim Charkov, Airbnb
Visualize Solr Data with Banana: Presented by Andrew Thanalertvisuti, Lucidworks
Solr for Analytics
Large Scale ETL for Hadoop and Cloudera Search using Morphlines
Webinar Google Analytics Real Time MA 22-11-11
Real-Time Big Data with Storm, Kafka and GigaSpaces
Cloudera Search Webinar: Big Data Search, Bigger Insights
Never Stop Exploring - Pushing the Limits of Solr: Presented by Anirudha Jadh...
Build a Great Application in Minutes!: Presented by Stefan Olafsson, Twigkit
Semantic & Multilingual Strategies in Lucene/Solr: Presented by Trey Grainger...
Webinar: Simpler Semantic Search with Solr
Large Scale Crawling with Apache Nutch and Friends
Webinar: Natural Language Search with Solr
Using Morphlines for On-the-Fly ETL
A Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
Galene - LinkedIn's Search Architecture: Presented by Diego Buthay & Sriram S...
How We Used Cassandra/Solr to Build Real-Time Analytics Platform
Nested Types in Impala
Webinar: What's New in Solr 6
Natural Language Search in Solr
Airbnb Search Architecture: Presented by Maxim Charkov, Airbnb
Ad

Similar to Real-Time Analytics with Solr: Presented by Yonik Seeley, Cloudera (20)

PPTX
Solr 6 Feature Preview
ODP
ELK Stack - Turn boring logfiles into sexy dashboard
PDF
Infrastructure as Code with Terraform
PDF
Building Analytics Applications with Streaming Expressions in Apache Solr - A...
PDF
Streaming Solr - Activate 2018 talk
PDF
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
PDF
Scalding big ADta
PPTX
MongoDB 3.0
PPTX
1403 app dev series - session 5 - analytics
PDF
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
PDF
Applied Machine learning using H2O, python and R Workshop
PDF
Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...
PPTX
Introducing DataWave
PPTX
Dublin Ireland Spark Meetup October 15, 2015
PDF
Building analytics applications with streaming expressions in apache solr
PPTX
HBase Data Modeling and Access Patterns with Kite SDK
PDF
IE9에서 HTML5 개발하기
PDF
managing big data
PPTX
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
PDF
MongoDB Meetup
Solr 6 Feature Preview
ELK Stack - Turn boring logfiles into sexy dashboard
Infrastructure as Code with Terraform
Building Analytics Applications with Streaming Expressions in Apache Solr - A...
Streaming Solr - Activate 2018 talk
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Scalding big ADta
MongoDB 3.0
1403 app dev series - session 5 - analytics
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
Applied Machine learning using H2O, python and R Workshop
Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...
Introducing DataWave
Dublin Ireland Spark Meetup October 15, 2015
Building analytics applications with streaming expressions in apache solr
HBase Data Modeling and Access Patterns with Kite SDK
IE9에서 HTML5 개발하기
managing big data
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
MongoDB Meetup

More from Lucidworks (20)

PDF
Search is the Tip of the Spear for Your B2B eCommerce Strategy
PDF
Drive Agent Effectiveness in Salesforce
PPTX
How Crate & Barrel Connects Shoppers with Relevant Products
PPTX
Lucidworks & IMRG Webinar – Best-In-Class Retail Product Discovery
PPTX
Connected Experiences Are Personalized Experiences
PDF
Intelligent Insight Driven Policing with MC+A, Toronto Police Service and Luc...
PPTX
[Webinar] Intelligent Policing. Leveraging Data to more effectively Serve Com...
PPTX
Preparing for Peak in Ecommerce | eTail Asia 2020
PPTX
Accelerate The Path To Purchase With Product Discovery at Retail Innovation C...
PPTX
AI-Powered Linguistics and Search with Fusion and Rosette
PDF
The Service Industry After COVID-19: The Soul of Service in a Virtual Moment
PPTX
Webinar: Smart answers for employee and customer support after covid 19 - Europe
PDF
Smart Answers for Employee and Customer Support After COVID-19
PPTX
Applying AI & Search in Europe - featuring 451 Research
PPTX
Webinar: Accelerate Data Science with Fusion 5.1
PDF
Webinar: 5 Must-Have Items You Need for Your 2020 Ecommerce Strategy
PPTX
Where Search Meets Science and Style Meets Savings: Nordstrom Rack's Journey ...
PPTX
Apply Knowledge Graphs and Search for Real-World Decision Intelligence
PPTX
Webinar: Building a Business Case for Enterprise Search
PPTX
Why Insight Engines Matter in 2020 and Beyond
Search is the Tip of the Spear for Your B2B eCommerce Strategy
Drive Agent Effectiveness in Salesforce
How Crate & Barrel Connects Shoppers with Relevant Products
Lucidworks & IMRG Webinar – Best-In-Class Retail Product Discovery
Connected Experiences Are Personalized Experiences
Intelligent Insight Driven Policing with MC+A, Toronto Police Service and Luc...
[Webinar] Intelligent Policing. Leveraging Data to more effectively Serve Com...
Preparing for Peak in Ecommerce | eTail Asia 2020
Accelerate The Path To Purchase With Product Discovery at Retail Innovation C...
AI-Powered Linguistics and Search with Fusion and Rosette
The Service Industry After COVID-19: The Soul of Service in a Virtual Moment
Webinar: Smart answers for employee and customer support after covid 19 - Europe
Smart Answers for Employee and Customer Support After COVID-19
Applying AI & Search in Europe - featuring 451 Research
Webinar: Accelerate Data Science with Fusion 5.1
Webinar: 5 Must-Have Items You Need for Your 2020 Ecommerce Strategy
Where Search Meets Science and Style Meets Savings: Nordstrom Rack's Journey ...
Apply Knowledge Graphs and Search for Real-World Decision Intelligence
Webinar: Building a Business Case for Enterprise Search
Why Insight Engines Matter in 2020 and Beyond

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Electronic commerce courselecture one. Pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
KodekX | Application Modernization Development
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Advanced methodologies resolving dimensionality complications for autism neur...
Dropbox Q2 2025 Financial Results & Investor Presentation
Electronic commerce courselecture one. Pdf
Understanding_Digital_Forensics_Presentation.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Machine learning based COVID-19 study performance prediction
“AI and Expert System Decision Support & Business Intelligence Systems”
Digital-Transformation-Roadmap-for-Companies.pptx
Network Security Unit 5.pdf for BCA BBA.
KodekX | Application Modernization Development
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...

Real-Time Analytics with Solr: Presented by Yonik Seeley, Cloudera

  • 1. 1  ©  Cloudera,  Inc.  All  rights  reserved.   Real-­‐Time  Analy=cs  with  Solr   Yonik  Seeley   10/15/2015  
  • 2. 2  ©  Cloudera,  Inc.  All  rights  reserved.   My  Background   • Creator  of  Solr   • Cloudera  Engineer     • LucidWorks  Co-­‐Founder   • Lucene/Solr  commiMer,  PMC  member   • Apache  SoQware  Founda=on  member   • M.S.  in  Computer  Science,  Stanford  
  • 3. 3  ©  Cloudera,  Inc.  All  rights  reserved.   Solr  for  Analy=cs  
  • 4. 4  ©  Cloudera,  Inc.  All  rights  reserved.   Search  and  Hadoop   •  Search  is  a  key  component  of  many  big  data  problems   •  Many  analy=cs  use  cases  start  with  search   •  Adding  analy=cs  to  full-­‐text  search  has  proven  to  be  more  effec=ve  than   vice-­‐versa   •  External  integra=ons  are  challenging  for  "real-­‐=me"  (i.e.  interac=ve)   results      
  • 5. 5  ©  Cloudera,  Inc.  All  rights  reserved.   Solr  in  Hadoop     •  Top  Hadoop  vendors  who  have  integrated  search  have  all  chosen  Apache  Solr   • For  example:  Cloudera,  Hortonworks,  MapR,  IBM,  ...   •  Historical  focus  on  interac=ve  response  =mes   •  Historical  focus  on  faceted  search  /  guided  naviga=on   •  High  performance  indexes   • originally  for  "full-­‐text"  search,  but  just  as  great  for  meta-­‐data!  
  • 6. 6  ©  Cloudera,  Inc.  All  rights  reserved.   Inverted  Index   aardvark   hood   red   liMle   riding   robin   women   zoo   LiMle  Red  Riding  Hood   Robin  Hood   LiMle  Women   0   1   0   2   0   0   2   1   0   1   2   Documents  
  • 7. 7  ©  Cloudera,  Inc.  All  rights  reserved.   Columnar  Storage  (DocValues)   a1   a2   a3   a4   b1   b2   b3   b4   c1   c2   c3   c4   a1   b1   c1  a3   b3   c3   Stored  Fields   (row  oriented)   DocValues   (column  oriented)   a1   b1   c1  a1   b1   c1   ...   a1   b1   c1  a2   b2   c3   ...   •  Fast  linear  scan   • Read  only  the  data  you  need   •  Fast  random  access   • docid  -­‐>  value(s)   •  High  degree  of  locality   •  Compressed   • prefix,  delta,  table,  gcd,  etc   •  Mostly  "Off-­‐Heap"   • Memory  mapped  from  index   •  Row  vs  Column  configurable  per  field!  
  • 8. 8  ©  Cloudera,  Inc.  All  rights  reserved.   Mul=-­‐Segment  Index   _0.fnm   _0.fdt   _0.fdx   [...]   _0_1.del   _1.fnm   _1.fdt   _1.fdx   […]   segments_3   •  Each  segment  is  a  self-­‐contained  "index"   •  Segments  are  never  changed  once  wriMen   •  Per-­‐segment  caching  very  effec=ve   •  Point-­‐in-­‐=me  searcher   •  gejng  new  view  means  wri=ng  &   including  addi=onal  segment   •  turns  a  weakness  into  a  strength  
  • 9. 9  ©  Cloudera,  Inc.  All  rights  reserved.   Faceted  Search   •  Breaks  search  results  into   buckets   •  Generally  provides  bucket   counts   •  Allows  user  to  filter  /  "drill   into"  results  
  • 10. 10  ©  Cloudera,  Inc.  All  rights  reserved.   New  Facet  Module  
  • 11. 11  ©  Cloudera,  Inc.  All  rights  reserved.   Face=ng   Search   Sta=s=cs   Facet  Module  Goals   Search   Joins   Grouping   Field   Collapsing   New  Facet  Module   JSON  Facet  API   •  Integra=on   •  Performance   •  Ease  of  use   Highligh=ng   Nested   Documents   Geosearch  
  • 12. 12  ©  Cloudera,  Inc.  All  rights  reserved.   Slice  and  Dice  with  Facet  commands   Domain   Facet   Command   A   •  Domain:  A  set  of  documents   •  Facet  command:  create  sub-­‐domains  /  "facet  buckets"   Facet   Command   B   Domain   Domain   Domain   Domain   Facet   Command   C   Domain   Domain   Domain   Domain   Domain   Domain  
  • 13. 13  ©  Cloudera,  Inc.  All  rights  reserved.   Facet  Func=ons  /  Sta=s=cs   Domain   Facet   Command   A   Facet   Command   B   Domain   Domain   Domain   Domain   Facet   Command   C   Domain   Domain   Domain   Domain   Domain   Domain   sum(x)   unique(y)   sum(x)   unique(y)   sum(x)   unique(y)   min(units)   avg(price)   •  Facet  func=on  calculates  something  over  a  domain   •  Can  sort  domains  by  facet  func=ons!  
  • 14. 14  ©  Cloudera,  Inc.  All  rights  reserved.   Facet  func=ons   •  Calculate  (and  Sort)  by  things  other  than  document  count   Func%on   Example   Descrip%on   sum   sum(sales)   Summa=on  of  numeric  values   avg   avg(popularity)   Average  of  numeric  values     sumsq   sumsq(rent)   Sum  of  squares   min   min(salary)   Minimum  value   max   max(mul(popularity,boost))   Maximum  value   unique   unique(state)   Number  of  unique  values  (calc  dis=nct)   hll   hll(state)   Number  of  unique  values  using  HyperLogLog  algorithm   percen=le   percen=le(salary,  25,  50,  75)   Calculates  percen=les  via  t-­‐digest  algorithm   topdocs   topdocs("another  query",5)   (in  progress)  Returns  the  top  documents  for  another  query  
  • 15. 15  ©  Cloudera,  Inc.  All  rights  reserved.   Simple  request  and  response   curl  http://localhost:8983/solr/query  -­‐d  '   q=widgets&   json.facet=   {      x  :  "avg(price)"  ,        y  :  "unique(brand)"   }   '     […]   "facets"  :  {      "count"  :  314,      "x"  :  102.5,      "y"  :  28   }   root  domain  defined  by  docs   matching  the  query   count  of  docs  in  the  bucket  
  • 16. 16  ©  Cloudera,  Inc.  All  rights  reserved.   All-­‐JSON  request  example   $  curl  http://localhost:8983/solr/query  -­‐d  '   {      query  :  "widgets",        //  our  JSON  parser  accepts  comments  (C-­‐style  too)      filter  :  "inStock:true",      //  bare  strings  can  appear  unquoted      offset:  0,      limit:  5,      sort:  "price  desc",      fields:  ["id","name","price"],    /*  could  have  also  used  "id,name,price"  */      facet  :  {          x  :  "avg(price)",          y  :  "unique(brand)"      }   }   '  
  • 17. 17  ©  Cloudera,  Inc.  All  rights  reserved.   Bucke=ng  Facet  Types   •  Terms  Facet   • Creates  new  domains  (facet  buckets)  based  on  values  in  a  field   •  Range  Facet   • Creates  mul=ple  buckets  based  on  date  ranges  or  numeric  ranges   •  Query  Facet   • Creates  a  single  bucket  of  documents  that  match  any  given  query   •  Unlimited  nes=ng:  Any  facet  types  may  have  any  number  of  sub-­‐facets  
  • 18. 18  ©  Cloudera,  Inc.  All  rights  reserved.   Terms  facet  example    json.facet={        shoes  :  {            type  :  terms,              field  :  shoe_style,            sort  :  {x  :  desc},            facet  :  {                x  :  "avg(price)",                y  :  "unique(brand)"            }        }    }   "facets":  {      "count"  :  472,      "shoes":  {          "buckets"  :  [              {                  "val"  :  "Hiking",                  "count"  :  34,                  "x"  :  135.25,                  "y"  :  17,              },              {                  "val"  :  "Running",                  "count"  :  45,                  "x"  :  110.75,                  "y"  :  24,              },     Calculated  per-­‐bucket  
  • 19. 19  ©  Cloudera,  Inc.  All  rights  reserved.   Sub-­‐facet  example    json.facet={        shoes:{            type  :  terms,            field  :  shoe_style,            sort  :  {x  :  desc},            facet  :  {                x  :  "avg(price)",                y  :  "unique(brand)",                colors  :  {                    type  :  terms,                    field  :  color                }              }        }    }   "facets":  {      "count"  :  472,      "shoes":  {          "buckets"  :  [              {                  "val"  :  "Hiking",                  "count"  :  34,                  "x"  :  135.25,                  "y"  :  17,                  "colors"  :  {                      "buckets"  :  [                          {  "val"  :  "brown",                              "count"  :  12  },                          {  "val"  :  "black",                              "count"  :  10                          },  […]                      ]                  }  //  end  of  colors  sub-­‐facet              },  //  end  of  Hiking  bucket              {                  "val"  :  "Running",                  "count"  :  45,                  "x"  :  110.75,                  "y"  :  24,                  "colors"  :  {                      "buckets"  :  […]  
  • 20. 20  ©  Cloudera,  Inc.  All  rights  reserved.   BI  Usecase  
  • 21. 21  ©  Cloudera,  Inc.  All  rights  reserved.   Fantasy  ($1045)     Top  Authors   $423  George  R.R.  Mar=n   $347  Brandon  Sanderson   $155  JK  Rowling     Top  Books   $252  A  Game  of  Thrones   $113  Emperor  of  Thorns   $101  Nine  Princes  in  Amber   $82      Steel  Heart   Sci-­‐Fi  ($898)     Top  Authors   $321  Iain  M  Banks   $218  Neal  Asher   $155  Neal  Stephenson     Top  Books   $113  Gridlinked   $101  Use  of  Weapons   $93      Snow  Crash   $82      The  Skinner   Mystery  ($645)     Top  Authors   $191  James  PaMerson   $145  Patricia  Cornwell   $126  John  Grisham     Top  Books   $85    One  for  the  Money   $77    Angels  &  Daemons   $64    ShuMer  Island   $35    The  Firm   Filter  By   State   $852  NJ      (14  stores)   $658  NY    (11  stores)   $421  CT      (8  stores)     Chain   $984  Amazoon                        (14  stores)   $734  Houses&Royalty  (9  stores)   $387  Books-­‐r-­‐us                      (7  stores)     Store   $108  Amazoon  Branchburg   $93      Books-­‐r-­‐us  Bridgewater   $87      H&R  NYC         Number  of  Books     Chain   201K  Houses&Royalty   183K  Amazoon   98K      Books-­‐r-­‐us     Store   193K  H&R  NYC   77K      Books-­‐r-­‐us  Bridgewater   68K      Amazoon  Branchburg    
  • 22. 22  ©  Cloudera,  Inc.  All  rights  reserved.   date_breakout  :  {        type  :  range,        field  :  sale_date,        start  :  ...,        end  :  ...,        gap  :  "+1MONTH”,        facet  :  {                  top_genres  :  {                        type  :  terms                      field  :  genre,                      sort  :  "revenue  desc",                      limit  :  4,                      facet  :  {                            revenue  :  "sum(sales)"                      }                },              by_chain:  {                      type  :  terms,                      field  :  chain,                      facet  :  {                            revenue  :  "sum(sales)"                      }              }   Implementa=on   Range  Facet   (sale_date)   Terms  Facet   (genre)   Terms  Facet   (chain)   sum(sales)   sum(sales)  
  • 23. 23  ©  Cloudera,  Inc.  All  rights  reserved.   Fantasy  ($1045)     Top  Authors   $423  George  R.R.  Mar=n   $347  Brandon  Sanderson   $155  JK  Rowling     Top  Books   $252  A  Game  of  Thrones   $113  Emperor  of  Thorns   $101  Nine  Princes  in  Amber   $82      Steel  Heart   Sci-­‐Fi  ($898)     Top  Authors   $321  Iain  M  Banks   $218  Neal  Asher   $155  Neal  Stephenson     Top  Books   $113  Gridlinked   $101  Use  of  Weapons   $93      Snow  Crash   $82      The  Skinner   Mystery  ($645)     Top  Authors   $191  James  PaMerson   $145  Patricia  Cornwell   $126  John  Grisham     Top  Books   $85    One  for  the  Money   $77    Angels  &  Daemons   $64    ShuMer  Island   $35    The  Firm   top_genres:{          type  :  terms,          field  :  genre,          facet  :  {                rev  :  "sum(sales)",                top_authors:{                    type  :  terms,                    field  :  author,                    sort    :"rev  desc",                    limit  :  3,                    facet  :  {  rev  :  "sum(sales)"  }                },                top_books:{                    type  :  terms,                    field  :  =tle,                    sort    :  "rev  desc",                    limit  :  4,                    facet  :  {  rev  :  "sum(sales)"  }                }        }   Implementa=on  (con=nued)   Terms  Facet   (genre)   Terms  Facet   (author)   Terms  Facet   (=tle)   sum(sales)   sum(sales)   sum(sales)  
  • 24. 24  ©  Cloudera,  Inc.  All  rights  reserved.   Performance  
  • 25. 25  ©  Cloudera,  Inc.  All  rights  reserved.   facet=true&stats=true   &stats.field={!tag=stat1+mean=true}field2   &facet.pivot={!stats=stat1}field1   &f.field1.limit=10   json.facet={          f  :  {                  type  :  terms,                  field  :  field1,                  facet:{  mean:"avg(field2)"  }          }   }   Tested  Facet  Request   Legacy (stats component & pivot facets) JSON Facet API (New Facet Module)
  • 26. 26  ©  Cloudera,  Inc.  All  rights  reserved.  
  • 27. 27  ©  Cloudera,  Inc.  All  rights  reserved.  
  • 28. 28  ©  Cloudera,  Inc.  All  rights  reserved.   Nested  Documents  
  • 29. 29  ©  Cloudera,  Inc.  All  rights  reserved.   Indexing  Nested  Documents   id  :  book1   =tle  :  The  Way  of  Kings   author  :  Brandon  Sanderson   id  :  book1_review1   review_author  :  Yonik   stars  :  5   comment  :  A  great  start  to  what  ...   id  :  book1_review2   review_author  :  Dan   stars  :  3   comment  :  This  book  was  too  long   id  :  book2   =tle  :  Snow  Crash   author  :  Neal  Stephenson   id  :  book2_review1   review_author  :  Yonik   stars  :  5   comment  :  Ahead  of  it's  =me  ...   book1_review1   book1_review2   book1   book2_review1   book2   Lucene  index  view  (flat)   •  Group  indexed  as  a  "block"   •  atomic   •  internal  document  ids  con=guous   •  enables  quick  and  inexpensive  joins  
  • 30. 30  ©  Cloudera,  Inc.  All  rights  reserved.   Indexing  Nested  Documents  (JSON  format)   {    id  :  book1,    type  :  book,    =tle  :  "The  Way  of  Kings",    author  :  "Brandon  Sanderson",        genre  :  fantasy,    pubyear  :  2010,    publisher  :  Tor,      _childDocuments_  :  [                    {    id  :  book1_review1,    type  :  review,    review_dt:"2015-­‐01-­‐03T14:30:00Z",                          stars  :  5,    review_author  :  Yonik,                          comment  :  "A  great  start  to  what  looks  like  an  epic  series!"                    }  ,                    {    id  :  book1_review2,    type  :  review,    review_dt:"2015-­‐03-­‐15T12:00:00Z",                          stars  :  3,  review_author  :  Dan,                          comment  :  "This  book  was  too  long."                    }          ]    }  
  • 31. 31  ©  Cloudera,  Inc.  All  rights  reserved.   Block  Join  Queries   Find  reviews  men=oning  "epic",  limi=ng  to  reviews  for  books  published  by  Tor             Find  books  published  by  Tor  with  a  review  men=oning  "epic"    q=comment:epic    fq={!child  of="type:book"}publisher:Tor    sort=review_dt  desc    q=publisher:Tor    fq={!parent  which="type:book"}comment:epic    sort=pubyear  desc  
  • 32. 32  ©  Cloudera,  Inc.  All  rights  reserved.   Block  Join  Face=ng  (child  to  parent)     •  Find  the  number  of  books  I  (Yonik)  reviewed,  broken  out  by  Genre   q=review_author:Yonik&   json.facet={          genres  :  {                  type  :  terms,                  field  :  genre,                  domain  :  {  blockParent  :  "type:book"  }            }   }  
  • 33. 33  ©  Cloudera,  Inc.  All  rights  reserved.   Block  Join  Face=ng  (parent  to  child)     •  Find  the  top  reviewers  for  sci-­‐fi  and  fantasy  books   q=genre:(sci-­‐fi  OR  fantasy)&   json.facet={          top_reviewers  :  {                  type:  terms,                  field:  review_author,                  domain:  {  blockChildren  :  "type:book"  }            }   }  
  • 34. 34  ©  Cloudera,  Inc.  All  rights  reserved.   Thank  you   yonik@cloudera.com