Should filtering by type and type-specific search URL return different results?


(James Wilson) #1

I'm seeing something puzzling: I have a query that returns quite
different results depending on how I restrict the query by type.

(1) adding "filter": { "type": { "value": "my_type" } } into the query
(2) restricting the search in the URL : curl -XGET http://localhost:9200/index/my_type
...

I use a document level _boost that is seemingly ignored when the query
is run using (1). Shouldn't these two methods be equivalent? Or what
is the difference that I am missing?


Elastic Search Request Body search by _type
(Eric Jain) #2

On Mar 14, 11:27 am, James Wilson jwilson...@gmail.com wrote:

I'm seeing something puzzling: I have a query that returns quite
different results depending on how I restrict the query by type.

(1) adding "filter": { "type": { "value": "my_type" } } into the query
(2) restricting the search in the URL : curl -XGEThttp://localhost:9200/index/my_type
...

I use a document level _boost that is seemingly ignored when the query
is run using (1). Shouldn't these two methods be equivalent? Or what
is the difference that I am missing?

By "different results", you mean the same results, but in a different
order? I don't know what /index/my_type is translated into, but filter
results in general don't have a guaranteed order.


(James Wilson) #3

I mean totally different results, where a result with a huge document-
level boost is missing when using (1).

On Mar 14, 1:13 pm, Eric Jain eric.j...@gmail.com wrote:

On Mar 14, 11:27 am, James Wilson jwilson...@gmail.com wrote:

I'm seeing something puzzling: I have a query that returns quite
different results depending on how I restrict the query by type.

(1) adding "filter": { "type": { "value": "my_type" } } into the query
(2) restricting the search in the URL : curl -XGEThttp://localhost:9200/index/my_type
...

I use a document level _boost that is seemingly ignored when the query
is run using (1). Shouldn't these two methods be equivalent? Or what
is the difference that I am missing?

By "different results", you mean the same results, but in a different
order? I don't know what /index/my_type is translated into, but filter
results in general don't have a guaranteed order.


(Clinton Gormley) #4

On Wed, 2012-03-14 at 11:27 -0700, James Wilson wrote:

I'm seeing something puzzling: I have a query that returns quite
different results depending on how I restrict the query by type.

(1) adding "filter": { "type": { "value": "my_type" } } into the query
(2) restricting the search in the URL : curl -XGET http://localhost:9200/index/my_type
...

I use a document level _boost that is seemingly ignored when the query
is run using (1). Shouldn't these two methods be equivalent? Or what
is the difference that I am missing?

Could you gist a complete curl example demonstrating the issue?

ta

clint


(Shay Banon) #5

A recreation would be great. Note though, that hte field name that the type
uses is named "_type", not "type". When you search on
/index_name/type_name, the query executed is wrapped with a filter against
_type field.

On Fri, Mar 16, 2012 at 8:48 AM, Clinton Gormley clint@traveljury.comwrote:

On Wed, 2012-03-14 at 11:27 -0700, James Wilson wrote:

I'm seeing something puzzling: I have a query that returns quite
different results depending on how I restrict the query by type.

(1) adding "filter": { "type": { "value": "my_type" } } into the query
(2) restricting the search in the URL : curl -XGET
http://localhost:9200/index/my_type
...

I use a document level _boost that is seemingly ignored when the query
is run using (1). Shouldn't these two methods be equivalent? Or what
is the difference that I am missing?

Could you gist a complete curl example demonstrating the issue?

ta

clint


(system) #6