Get by ID appears to bypass Alias / Filter


(Brent Gracey) #1

Hi,

I have an Alias set up to filter on a field called owner

http://localhost:9200/message/_alias/*

{"message":{"aliases":{"123":{"filter":{"term":{"owner":"123"}}}}}}

It appears that if I do a GET by ID on the alias, documents are returned,
even if their owner field is not "123" - so the filter does not take effect.

Is this expected behaviour? If so, is there any way to enfore that the
filter is applied to the GET by Id API?

Two test records are held, one owner is 123 the other is 7984

{
_index: message
_type: data
_id:* pQc6hWe6Sz2Oagm-nAFN1w*
_version: 1
_score: 1
_source: {
owner: 7894
type: email
...
}

{
_index: message
_type: data
_id: kBbun94eTOSPz_Aot3S3Mg
_version: 1
_score: 1
_source: {
owner: 123
type: email
}

Both http://localhost:9200/123/data/pQc6hWe6Sz2Oagm-nAFN1w/ and
http://localhost:9200/123/data*/kBbun94eTOSPz_Aot3S3Mg/ *return the
respective records.
A search has it results filtered by owner as expected.

Thanks
Brent

--
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.


(Luca Cavanna) #2

Hi,
right, the alias filter is not currently taken into account by the get api.
We already have an open issue for it
too: https://github.com/elasticsearch/elasticsearch/issues/3861.
As mentioned in the issue, the tricky bit is that a get operation is
real-time, while a search operation is near real-time. Applying the filter
would mean executing a search... which would lead to lose the real-time
aspect of the get api.

On Friday, November 1, 2013 7:13:44 PM UTC+1, Brent Gracey wrote:

Hi,

I have an Alias set up to filter on a field called owner

http://localhost:9200/message/_alias/*

{"message":{"aliases":{"123":{"filter":{"term":{"owner":"123"}}}}}}

It appears that if I do a GET by ID on the alias, documents are returned,
even if their owner field is not "123" - so the filter does not take effect.

Is this expected behaviour? If so, is there any way to enfore that the
filter is applied to the GET by Id API?

Two test records are held, one owner is 123 the other is 7984

{
_index: message
_type: data
_id:* pQc6hWe6Sz2Oagm-nAFN1w*
_version: 1
_score: 1
_source: {
owner: 7894
type: email
...
}

{
_index: message
_type: data
_id: kBbun94eTOSPz_Aot3S3Mg
_version: 1
_score: 1
_source: {
owner: 123
type: email
}

Both http://localhost:9200/123/data/pQc6hWe6Sz2Oagm-nAFN1w/ and
http://localhost:9200/123/data*/kBbun94eTOSPz_Aot3S3Mg/ *return the
respective records.
A search has it results filtered by owner as expected.

Thanks
Brent

--
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.


(Brent Gracey) #3

OK - thanks for confirming and pointing out the relevant ticket

Cheers

--
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.


(system) #4