ElasticSearch php sdk simple query not working -


this first question here, having problem simple elasticsearch query made throught php sdk, json example:

{ "_id": "event:5569fbbdddc85", "_type": "event", "videos": {}, "status": "published", "owner": {   "firstname": "patricio",   "lastname": "",   "profilepicture": "http://pbs.twimg.com/profile_images/581193413426544640/q5aqmmpk_normal.jpg",   "_id": "twitter:2383339241",   "_type": "user",   "updated": 1433008088365,   "created": 1428439794713   }, "max_age": "18", "min_age": "18", "max_invites": "5", "min_invites": "2", "updated": 1433009134942, "created": 1433009134942 } 

what need filter owner._id , doing this:

    $params['index'] = 'default';     $params['type'] = 'event';     $params['size'] = $limit;     $params['from'] = $from;      $params['body']['query']['match']['owner._id'] = $userid;  //  elasticsearch search query     $res = \es::search($params); 

the result no filter. events in database comming back.

i following docs, no results, missing something

thanks!

you need _id field not_analyzed or analyzed keyword analyzer that, when indexed es, stay unchanged.

also, query yours, _id best use filter of type term. no php developer, es point of view should this:

      "_id": {         "type": "string",         "index": "not_analyzed"       } 

and query should of form, _id:

  "query": {     "filtered": {       "filter": {         "term": {           "owner._id": "twitter:2383339242"         }       }     }   } 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -