Monday, 17 April 2017

Is there a way to return a document body after indexing?

I am looking to return the full contents of a document after it is indexed. Elastic only returns:

{ 
    _index: 'doc-dataset',
    _type: 'my-doc',
    _id: 'AVt8nyuxRNHpCQ5APUtx',
    _version: 1,
    result: 'created',
    _shards: { total: 2, successful: 1, failed: 0 },
    created: true,
    status: 201 
}

I would like it to return something like:

{ 
    _index: 'doc-dataset',
    _type: 'my-doc',
    _id: 'AVt8nyuxRNHpCQ5APUtx',
    _version: 1,
    result: 'created',
    _shards: { total: 2, successful: 1, failed: 0 },
    created: true,
    status: 201,
    source:{
        prop: value,
        prop: value,
        ...
        prop: value
}

Is this possible?



via Dominic Cabral

No comments:

Post a Comment