ElasticSearch filtered query match_all

I'm getting matches on the date field and the post.user field, I wish to
only get matches on the post.user field. I assume it might have something
to do with the match_all but I don't know.

Mapping

"xenforo113" : {
"post" : {
"_source" : {
"enabled" : false
},
"properties" : {
"date" : {
"type" : "long",
"store" : "yes"
},
"discussion_id" : {
"type" : "long",
"store" : "yes"
},
"message" : {
"type" : "string"
},
"node" : {
"type" : "long"
},
"thread" : {
"type" : "long"
},
"title" : {
"type" : "string"
},
"user" : {
"type" : "long",
"store" : "yes"
}
}
}

Query

$data_string = '{
"from" : 0, "size" : 200,
"sort" : [
{ "date" : {"order" : "desc"} }
],
"query": {
"filtered": {
"query": {
"match_all": {
}
},
"filter": {
"bool": {
"must": {
"term": {
"post.user": "' . $user_id . '"
}
},
"must_not": {
"range": {
"node": {
"from": 100,
"to": 100
}
}
}
}
}
}
}
}';

How would I modify this query so I get results on only the post.user field?

Thank you.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Can you post a full curl recreation? Which document is supposed to match?
I don't see anything weird in your query.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 18 avr. 2013 à 19:03, Andy Bajka andybajka2012@gmail.com a écrit :

I'm getting matches on the date field and the post.user field, I wish to only get matches on the post.user field. I assume it might have something to do with the match_all but I don't know.

Mapping

"xenforo113" : {
"post" : {
"_source" : {
"enabled" : false
},
"properties" : {
"date" : {
"type" : "long",
"store" : "yes"
},
"discussion_id" : {
"type" : "long",
"store" : "yes"
},
"message" : {
"type" : "string"
},
"node" : {
"type" : "long"
},
"thread" : {
"type" : "long"
},
"title" : {
"type" : "string"
},
"user" : {
"type" : "long",
"store" : "yes"
}
}
}

Query

$data_string = '{
"from" : 0, "size" : 200,
"sort" : [
{ "date" : {"order" : "desc"} }
],
"query": {
"filtered": {
"query": {
"match_all": {
}
},
"filter": {
"bool": {
"must": {
"term": {
"post.user": "' . $user_id . '"
}
},
"must_not": {
"range": {
"node": {
"from": 100,
"to": 100
}
}
}
}
}
}
}
}';

How would I modify this query so I get results on only the post.user field?

Thank you.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.