Get returns source even though source is disabled

During writing tests for Elastica I received a result that I was not
expecting. I create a index and set the mapping to not store the source, but
I set store to yes on one field. Then, when I query I can received the
stored field and no source is returned (as expected). But when I explicitly
get the document, the source is returned. I would expect that it says, field
exists but that id does not return the source. I created a gist with an
example:

I guess it is because this call:
curl -XGET 'http://localhost:9200/test/test/1?pretty=true
fetch the document from the transaction log and so it gets the _source
there.

But if you flush using curl -XPOST 'http://localhost:9200/test/_flush'

Then you have the behavior you expect.

Thx, this solved the problem. And probably also explains an other problem I sometimes have.

@ruflin
useKit.com
Xodoa.com

On 30.09.2011, at 11:55, Benjamin Devèze wrote:

I guess it is because this call:
curl -XGET 'http://localhost:9200/test/test/1?pretty=true
fetch the document from the transaction log and so it gets the _source there.

But if you flush using curl -XPOST 'http://localhost:9200/test/_flush'

Then you have the behavior you expect.

This happens because of how realtime gets works. Basically, realtime get
works from the _source, and when you ask for a field which is stored, it
will try and parse the source and return it if its a realtime get. You can
always set realtime flag set to false on the GET operation, and disable this
behavior (btw).

On Fri, Sep 30, 2011 at 4:42 PM, Nicolas Ruflin mail@ruflin.com wrote:

Thx, this solved the problem. And probably also explains an other problem I
sometimes have.

@ http://twitter.com/ruflinruflin http://twitter.com/ruflin
useKit.com
Xodoa.com http://xodoa.com/
Ruflin.com http://ruflin.com

On 30.09.2011, at 11:55, Benjamin Devèze wrote:

I guess it is because this call:
curl -XGET 'http://localhost:9200/test/test/1?pretty=true
fetch the document from the transaction log and so it gets the _source
there.

But if you flush using curl -XPOST 'http://localhost:9200/test/_flush'

Then you have the behavior you expect.

Thx for the explanation. In general I really like the realtime get. It was just a "testing" issue.

@ruflin
useKit.com
Xodoa.com

On 02.10.2011, at 12:50, Shay Banon wrote:

This happens because of how realtime gets works. Basically, realtime get works from the _source, and when you ask for a field which is stored, it will try and parse the source and return it if its a realtime get. You can always set realtime flag set to false on the GET operation, and disable this behavior (btw).

On Fri, Sep 30, 2011 at 4:42 PM, Nicolas Ruflin mail@ruflin.com wrote:
Thx, this solved the problem. And probably also explains an other problem I sometimes have.

@ruflin
useKit.com
Xodoa.com
Ruflin.com

On 30.09.2011, at 11:55, Benjamin Devèze wrote:

I guess it is because this call:
curl -XGET 'http://localhost:9200/test/test/1?pretty=true
fetch the document from the transaction log and so it gets the _source there.

But if you flush using curl -XPOST 'http://localhost:9200/test/_flush'

Then you have the behavior you expect.