Re: function score filter function doesn't seem to be cached

2015-02-13 Thread fforster
Explain shows the cached filter, but based on the time it takes (took: 528) 
I doubt it's used efficiently
 
{
value: 2
description: Math.min of
details: [
{
value: 2
description: function score, score mode [sum]
details: [
{
value: 2
description: function score, product of:
details: [
{
value: 1
description: match filter: cache(BooleanFilter(+cache(olbValid:T) 
+BooleanFilter(GeoPolygonFilter(location, [[34.081519, -118.3971081], 
[34.081519, -118.3440351], [34.131086, -118.3440351], [34.131086, 
-118.3971081], [34.081519, -118.3971081]]) GeoPolygonFilter(location, 
[[34.05576, -118.3907139], [34.05576, -118.361375], [34.083811, 
-118.361375], [34.083811, -118.3907139], [34.05576, -118.3907139]]) 
GeoPolygonFilter(location, [[34.0412758, -118.528682], [34.0412758, 
-118.453384], [34.1324337, -118.453384], [34.1324337, -118.528682], 
[34.0412758, -118.528682]]) GeoPolygonFilter(location, [[34.0518801, 
-118.28436], [34.0518801, -118.2665471], [34.072782, -118.2665471], 
[34.072782, -118.28436], [34.0518801, -118.28436]]) 
GeoPolygonFilter(location, [[34.017233, -118.46146], [34.017233, 
-118.39865], [34.0532549, -118.39865], [34.0532549, -118.46146], 
[34.017233, -118.46146]]) GeoPolygonFilter(location, [[33.973535, 
-118.455804], [33.973535, -118.407918], [34.0268609, -118.407918], 
[34.0268609, -118.455804], [33.973535, -118.455804]]) 
GeoPolygonFilter(location, [[34.0491411, -118.4215721], [34.0491411, 
-118.406023], [34.0639819, -118.406023], [34.0639819, -118.4215721], 
[34.0491411, -118.4215721]]) GeoPolygonFilter(location, [[34.1036901, 
-118.3678789], [34.1036901, -118.3010089], [34.152483, -118.3010089], 
[34.152483, -118.3678789], [34.1036901, -118.3678789]]) 
GeoPolygonFilter(location, [[34.0790469, -118.396506], [34.0790469, 
-118.3669411], [34.1075319, -118.3669411], [34.1075319, -118.396506], 
[34.0790469, -118.396506]]) GeoPolygonFilter(location, [[34.048743, 
-118.259363], [34.048743, -118.250157], [34.056087, -118.250157], 
[34.056087, -118.259363], [34.048743, -118.259363]]) 
GeoPolygonFilter(location, [[34.0734518, -118.4822519], [34.0734518, 
-118.422647], [34.132908, -118.422647], [34.132908, -118.4822519], 
[34.0734518, -118.4822519]]) GeoPolygonFilter(location, [[33.9658801, 
-118.4404339], [33.9658801, -118.397569], [33.9839929, -118.397569], 
[33.9839929, -118.4404339], [33.9658801, -118.4404339]]) 
GeoPolygonFilter(location, [[34.065094, -118.4423781], [34.065094, 
-118.3867129], [34.1354771, -118.3867129], [34.1354771, -118.4423781], 
[34.065094, -118.4423781]]) GeoPolygonFilter(location, [[34.057085, 
-118.390748], [34.057085, -118.3720269], [34.072342, -118.3720269], 
[34.072342, -118.390748], [34.057085, -118.390748]]) 
GeoPolygonFilter(location, [[34.0541081, -118.4163189], [34.0541081, 
-118.389668], [34.069207, -118.389668], [34.069207, -118.4163189], 
[34.0541081, -118.4163189]]) GeoPolygonFilter(location, [[33.9755489, 
-118.419822], [33.9755489, -118.37006], [34.0173769, -118.37006], 
[34.0173769, -118.419822], [33.9755489, -118.419822]]) 
GeoPolygonFilter(location, [[33.9016261, -118.4371209], [33.9016261, 
-118.3735181], [33.931641, -118.3735181], [33.931641, -118.4371209], 
[33.9016261, -118.4371209]]) GeoPolygonFilter(location, [[33.8504661, 
-118.414124], [33.8504661, -118.384853], [33.878445, -118.384853], 
[33.878445, -118.414124], [33.8504661, -118.414124]]) 
GeoPolygonFilter(location, [[33.9955069, -119.0699391], [33.9955069, 
-118.557949], [34.1443899, -118.557949], [34.1443899, -119.0699391], 
[33.9955069, -119.0699391]]) GeoPolygonFilter(location, [[33.8728038, 
-118.430009], [33.8728038, -118.3785991], [33.9061261, -118.3785991], 
[33.9061261, -118.430009], [33.8728038, -118.430009]]) 
GeoPolygonFilter(location, [[34.024999, -118.5875051], [34.024999, 
-118.495177], [34.13165, -118.495177], [34.13165, -118.5875051], 
[34.024999, -118.5875051]]) GeoPolygonFilter(location, [[33.8041178, 
-118.405002], [33.8041178, -118.3703771], [33.8580759, -118.3703771], 
[33.8580759, -118.405002], [33.8041178, -118.405002]]) 
GeoPolygonFilter(location, [[34.041016, -118.651771], [34.041016, 
-118.5512071], [34.145413, -118.5512071], [34.145413, -118.651771], 
[34.041016, -118.651771]]) GeoPolygonFilter(location, [[33.9765188, 
-118.4904589], [33.9765188, -118.4443409], [34.0147499, -118.4443409], 
[34.0147499, -118.4904589], [33.9765188, -118.4904589]]) 
GeoPolygonFilter(location, [[33.95876, -118.471863], [33.95876, 
-118.4241309], [33.994206, -118.4241309], [33.994206, -118.471863], 
[33.95876, -118.471863]]) GeoPolygonFilter(location, [[33.9163209, 
-118.4640851], [33.9163209, -118.41719], [33.974274, -118.41719], 
[33.974274, -118.4640851], [33.9163209, -118.4640851]]) 
GeoPolygonFilter(location, [[33.993572, -118.508206], [33.993572, 
-118.483473], [34.0256331, -118.483473], [34.0256331, -118.508206], 
[33.993572, -118.508206]]) GeoPolygonFilter(location, [[34.018217, 
-118.521865], [34.018217, -118.4837659], [34.05056, -118.4837659], 
[34.05056, -118.521865], 

function score filter function doesn't seem to be cached

2015-02-12 Thread fforster
I am using a function score with a function filter to score a subset of 
results higher. I specify to cache the function filter, but its performance 
is slower and slower the more clauses I add to the filter.

A query with 2 geo_polygons clauses returns relatively fast (30ms), but the 
more polygons clauses I add the slower it gets. With 50 polygons the call 
slows to 1s. Does elasticsearch actually cache the filter?

Example query with 2 geo_polygons clauses:
{
  query: {
function_score: {
  filter: {
bool: {
  must: [
{
  term: {
city: LA
  }
}
  ]
}
  },
  functions: [
{
  filter: {
bool: {
  should: [
{
  geo_polygon: {
location: {
  points: [
[
  -118.3971081,
  34.081519
],
[
  -118.3440351,
  34.081519
],
[
  -118.3440351,
  34.131086
],
[
  -118.3971081,
  34.131086
]
  ]
}
  }
},
{
  geo_polygon: {
location: {
  points: [
[
  -118.3907139,
  34.05576
],
[
  -118.361375,
  34.05576
],
[
  -118.361375,
  34.083811
],
[
  -118.3907139,
  34.083811
]
  ]
}
  }
}
  ],
  _cache: true
}
  },
  boost_factor: 2
}
  ],
  score_mode: sum
}
  }
}

-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/c990d908-2b15-4797-9300-22a71aeb4972%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: function score filter function doesn't seem to be cached

2015-02-12 Thread Jason Wee
set explain to true and read the explain output if cache is use?

Jason

On Fri, Feb 13, 2015 at 3:47 AM, ffors...@homeaway.com wrote:

 I am using a function score with a function filter to score a subset of
 results higher. I specify to cache the function filter, but its performance
 is slower and slower the more clauses I add to the filter.

 A query with 2 geo_polygons clauses returns relatively fast (30ms), but
 the more polygons clauses I add the slower it gets. With 50 polygons the
 call slows to 1s. Does elasticsearch actually cache the filter?

 Example query with 2 geo_polygons clauses:
 {
   query: {
 function_score: {
   filter: {
 bool: {
   must: [
 {
   term: {
 city: LA
   }
 }
   ]
 }
   },
   functions: [
 {
   filter: {
 bool: {
   should: [
 {
   geo_polygon: {
 location: {
   points: [
 [
   -118.3971081,
   34.081519
 ],
 [
   -118.3440351,
   34.081519
 ],
 [
   -118.3440351,
   34.131086
 ],
 [
   -118.3971081,
   34.131086
 ]
   ]
 }
   }
 },
 {
   geo_polygon: {
 location: {
   points: [
 [
   -118.3907139,
   34.05576
 ],
 [
   -118.361375,
   34.05576
 ],
 [
   -118.361375,
   34.083811
 ],
 [
   -118.3907139,
   34.083811
 ]
   ]
 }
   }
 }
   ],
   _cache: true
 }
   },
   boost_factor: 2
 }
   ],
   score_mode: sum
 }
   }
 }

 --
 You received this message because you are subscribed to the Google Groups
 elasticsearch group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to elasticsearch+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/elasticsearch/c990d908-2b15-4797-9300-22a71aeb4972%40googlegroups.com
 https://groups.google.com/d/msgid/elasticsearch/c990d908-2b15-4797-9300-22a71aeb4972%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAHO4itze5wyDX%2Bp3OC%2BPpN%3Db1XHLQQvKb68ZEeOnAA9tEAwiBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.