Results ordering assistance


(Flexage) #1

I have managed to set up a basic ElasticSearch server for testing purposes
before I develop the final code that will be used live.

I have set up an index (games2) and a type (game).

I managed to write a simple php script that imported into Elastic Search my
chosen fields from a games table in a mysql db (all field values were added
to ES as strings).

When I perform a search for "GameTitle" => "quake" I don't quite get the
ordering I would expect...

The 2 "Quake" titles on different platforms are returned as results 1 + 2,
but all the sequels seem to be ordered in a rather arbitrary fashion... I
would have expected the "Quake III Arena" matches to be next to each other,
as I would for the "Quake II" matches.

Why would this be? And does anyone know of an ElasticSearch query that may
provide the results I'd expect?

Included below is a dump of the results of my current basic query.

As always I appreciate any help at all and will be extremely grateful.

Thanks,

Alex

array
0 =>
array
'_index' => string 'games2' (length=6)
'_type' => string 'game' (length=4)
'_id' => string '777' (length=3)
'_score' => float 6.7300997
'_source' =>
array
'id' => string '777' (length=3)
'GameTitle' => string 'Quake' (length=5)
'Alternates' => null
'Platform' => string '1' (length=1)
'Genre' => string '|Shooter|' (length=9)
'Rating' => string 'M - Mature' (length=10)
'Players' => string '4' (length=1)
1 =>
array
'_index' => string 'games2' (length=6)
'_type' => string 'game' (length=4)
'_id' => string '2922' (length=4)
'_score' => float 6.045037
'_source' =>
array
'id' => string '2922' (length=4)
'GameTitle' => string 'Quake' (length=5)
'Alternates' => null
'Platform' => string '3' (length=1)
'Genre' => null
'Rating' => null
'Players' => null
2 =>
array
'_index' => string 'games2' (length=6)
'_type' => string 'game' (length=4)
'_id' => string '393' (length=3)
'_score' => float 3.778148
'_source' =>
array
'id' => string '393' (length=3)
'GameTitle' => string 'Quake II' (length=8)
'Alternates' => null
'Platform' => string '1' (length=1)
'Genre' => string '|Shooter|' (length=9)
'Rating' => string 'M - Mature' (length=10)
'Players' => string '0' (length=1)
3 =>
array
'_index' => string 'games2' (length=6)
'_type' => string 'game' (length=4)
'_id' => string '778' (length=3)
'_score' => float 3.778148
'_source' =>
array
'id' => string '778' (length=3)
'GameTitle' => string 'Quake 4' (length=7)
'Alternates' => null
'Platform' => string '1' (length=1)
'Genre' => string '|Shooter|' (length=9)
'Rating' => string 'M - Mature' (length=10)
'Players' => null
4 =>
array
'_index' => string 'games2' (length=6)
'_type' => string 'game' (length=4)
'_id' => string '2924' (length=4)
'_score' => float 3.7751212
'_source' =>
array
'id' => string '2924' (length=4)
'GameTitle' => string 'Quake II' (length=8)
'Alternates' => null
'Platform' => string '3' (length=1)
'Genre' => null
'Rating' => null
'Players' => null
5 =>
array
'_index' => string 'games2' (length=6)
'_type' => string 'game' (length=4)
'_id' => string '2925' (length=4)
'_score' => float 3.3634236
'_source' =>
array
'id' => string '2925' (length=4)
'GameTitle' => string 'Quake III Arena' (length=15)
'Alternates' => null
'Platform' => string '16' (length=2)
'Genre' => null
'Rating' => null
'Players' => null
6 =>
array
'_index' => string 'games2' (length=6)
'_type' => string 'game' (length=4)
'_id' => string '85' (length=2)
'_score' => float 3.020097
'_source' =>
array
'id' => string '85' (length=2)
'GameTitle' => string 'Enemy Territory: Quake Wars' (length=27)
'Alternates' => null
'Platform' => string '1' (length=1)
'Genre' => null
'Rating' => null
'Players' => string '0' (length=1)
7 =>
array
'_index' => string 'games2' (length=6)
'_type' => string 'game' (length=4)
'_id' => string '427' (length=3)
'_score' => float 3.020097
'_source' =>
array
'id' => string '427' (length=3)
'GameTitle' => string 'Quake III Arena' (length=15)
'Alternates' => null
'Platform' => string '1' (length=1)
'Genre' => null
'Rating' => string 'M - Mature' (length=10)
'Players' => string '0' (length=1)


(system) #2