Why match all and filter by username doesn't work for some usernames?


#1

i am trying to use elasticsearch for matching username.

$params['body']['query']['bool']['must']['match_all'] = (object)[];
$params['body']['query']['bool']['filter']['term']['uploader'] =  $_GET['uploader'];
$params['body']['sort']['upload_date']['order']= "desc" ;
$params['body']['from']	= 0;
$params['body']['size']	= 30;

i am doing it like this,.

match all documents and only get those which have username as i have specified using term filter

above query works for some usernames , but idk what happens when other usernames, it doesnt find the documents., even though there are documents., with uploader: username

or am i missing something ?

Thanks for your time.

my mapping is

{
	"mappings": {
    "content": { 
      "properties": { 
        "title":{ 
			"type":     "text",
			"fields": {
				"raw": { 
					"type":  "keyword"
				}
			}
		},
        "tags":    		{ "type": "text" },
        "category":     { "type": "keyword" },
        "sub_category":	{ "type": "keyword" },
        "size":      	{ "type": "long" },
        "uploaders":      { "type": "integer" },
        "downloaders":		{ "type": "integer" },
        "upload_date":	{
			"type":   "date",
			"format": "yyyy-MM-dd HH:mm:ss"
        },
		"uploader":{
					"type":     "text",
					"fields":	{
								"raw": { 
									"type":  "keyword"
								}
					}
		}
      }
	}
  }
}

(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.