数日間、エラスティカ クエリが機能しなくなりました。入力に問題はありません.GeoDistance部分を削除すると、リクエストが実行され、結果が得られます. 現在、トレースで次のメッセージを受け取りました。
"message": "1",
"class": "Elastica\\Exception\\PartialShardFailureException",
"trace": [
{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "",
"file": "/Applications/MAMP/htdocs/GTAB/what2days/api/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php",
"line": 150,
"args": []
}
それは私には何の意味もないので、$shardsStatistics
変数の var_export を作成したところ、次のようになりました。
array (
'total' => 6,
'successful' => 5,
'failed' => 1,
'failures' =>
array (
0 =>
array (
'index' => '.marvel-2014.09.16',
'shard' => 0,
'status' => 400,
'reason' => 'SearchParseException[[.marvel-2014.09.16][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"filtered":{"query":{"bool":{"must":[{"term":{"online":{"value":1}}}]}},"filter":{"bool":{"must":[{"geo_distance":{"distance":"100mi","location.latlon":{"lat":48.891773,"lon":2.3379156}}}]}}}}}},"size":"100"}]]]; nested: QueryParsingException[[.marvel-2014.09.16] failed to find geo_point field [location.latlon]]; ',
),
),
)
「 geo_point フィールド [location.latlon]] が見つかりませんでした」というエラー終了。_mapping を確認すると geo_point が存在し、プロパティの名前を間違えていないため、なぜ機能しないのかわかりません。
location: {
properties: {
latitude: {
type: "float",
store: true
},
latlon: {
type: "geo_point",
store: true,
lat_lon: true
},
longitude: {
type: "float",
store: true
}
}
},
そして、これは私が fos_elastica を設定する方法です
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
search:
finder: ~
types:
mytype:
mappings:
title:
type: string
online:
type: integer
information: ~
location:
type: object
properties:
longitude:
type: float
latlon:
type: geo_point
lat_lon: true
boost: 10
persistence:
driver: orm
model: API\Rest\v1\MyBundle\Entity\MyEntity
provider: ~
listener: ~
finder: ~
repository: API\Rest\v1\MyBundle\Repository\MyRepository
$query->getQuery() によって取得されたクエリ値 (次のクエリを参照) を使用して kopf リクエストを行うと、正しい結果が得られます。
{
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"term": {
"online": {
"value": 1
}
}
}
]
}
},
"filter": {
"bool": {
"must": [
{
"geo_distance": {
"distance": "1mi",
"location.latlon": {
"lat": 48.891773,
"lon": 2.3379156
}
}
}
]
}
}
}
}
}
どうすればいいのかわからない。私は 3.0.*@alpha バージョンを使用していましたが、今は dev-master を試しています。誰かが何が問題なのかを見つけるのを手伝ってくれることを願っています.
Elastica/Response.phpのメソッドで var_export を作成すると、前述getData
の失敗が発生し、1 つのヒット (取得したいもの) も発生します。