Return just the Json document id


(Mohit Anchlia) #1

We are planning to index Json document that could be as big as 200K. When
user executes search we just want the matching doc id instead of the entire
documents. How can I just get the id of the Json document?


(David Pilato) #2

Don't store source.
http://www.elasticsearch.org/guide/reference/mapping/source-field.html

Le 30 mai 2012 à 21:12, Mohit Anchlia mohitanchlia@gmail.com a écrit :

We are planning to index Json document that could be as big as 200K. When user executes search we just want the matching doc id instead of the entire documents. How can I just get the id of the Json document?


(Mohit Anchlia) #3

On Wed, May 30, 2012 at 12:23 PM, David Pilato david@pilato.fr wrote:

Don't store source.
http://www.elasticsearch.org/guide/reference/mapping/source-field.html

If I do store some portions of _source is it possible to fetch only few
fields instead of fetching all of them which seems to be the default?

Le 30 mai 2012 à 21:12, Mohit Anchlia mohitanchlia@gmail.com a écrit :

We are planning to index Json document that could be as big as 200K.
When user executes search we just want the matching doc id instead of the
entire documents. How can I just get the id of the Json document?


(David Pilato) #4

Yes. For each field you can set store to yes : http://www.elasticsearch.org/guide/reference/mapping/core-types.html

Then, you will be able to get it back (but not as a partial document).

HTH
David

Le 30 mai 2012 à 21:38, Mohit Anchlia mohitanchlia@gmail.com a écrit :

On Wed, May 30, 2012 at 12:23 PM, David Pilato david@pilato.fr wrote:
Don't store source.
http://www.elasticsearch.org/guide/reference/mapping/source-field.html

If I do store some portions of _source is it possible to fetch only few fields instead of fetching all of them which seems to be the default?

Le 30 mai 2012 à 21:12, Mohit Anchlia mohitanchlia@gmail.com a écrit :

We are planning to index Json document that could be as big as 200K. When user executes search we just want the matching doc id instead of the entire documents. How can I just get the id of the Json document?


(Mohit Anchlia) #5

On Wed, May 30, 2012 at 12:45 PM, David Pilato david@pilato.fr wrote:

Yes. For each field you can set store to yes :
http://www.elasticsearch.org/guide/reference/mapping/core-types.html

Then, you will be able to get it back (but not as a partial document).

Thanks! How does it work for nested document. If I specify it on the parent
does it store all the child elements too?

HTH
David

Le 30 mai 2012 à 21:38, Mohit Anchlia mohitanchlia@gmail.com a écrit :

On Wed, May 30, 2012 at 12:23 PM, David Pilato david@pilato.fr wrote:

Don't store source.
http://www.elasticsearch.org/guide/reference/mapping/source-field.html

If I do store some portions of _source is it possible to fetch only few
fields instead of fetching all of them which seems to be the default?

Le 30 mai 2012 à 21:12, Mohit Anchlia mohitanchlia@gmail.com a écrit :

We are planning to index Json document that could be as big as 200K.
When user executes search we just want the matching doc id instead of the
entire documents. How can I just get the id of the Json document?


(David Pilato) #6

I don't know. I never used nested.

Sorry :wink:

Le 30 mai 2012 à 21:54, Mohit Anchlia mohitanchlia@gmail.com a écrit :

On Wed, May 30, 2012 at 12:45 PM, David Pilato david@pilato.fr wrote:
Yes. For each field you can set store to yes : http://www.elasticsearch.org/guide/reference/mapping/core-types.html

Then, you will be able to get it back (but not as a partial document).

Thanks! How does it work for nested document. If I specify it on the parent does it store all the child elements too?

HTH
David

Le 30 mai 2012 à 21:38, Mohit Anchlia mohitanchlia@gmail.com a écrit :

On Wed, May 30, 2012 at 12:23 PM, David Pilato david@pilato.fr wrote:
Don't store source.
http://www.elasticsearch.org/guide/reference/mapping/source-field.html

If I do store some portions of _source is it possible to fetch only few fields instead of fetching all of them which seems to be the default?

Le 30 mai 2012 à 21:12, Mohit Anchlia mohitanchlia@gmail.com a écrit :

We are planning to index Json document that could be as big as 200K. When user executes search we just want the matching doc id instead of the entire documents. How can I just get the id of the Json document?


(Mohit Anchlia) #7

Thanks! I'll try it out and see how it goes

On Wed, May 30, 2012 at 1:12 PM, David Pilato david@pilato.fr wrote:

I don't know. I never used nested.

Sorry :wink:

Le 30 mai 2012 à 21:54, Mohit Anchlia mohitanchlia@gmail.com a écrit :

On Wed, May 30, 2012 at 12:45 PM, David Pilato david@pilato.fr wrote:

Yes. For each field you can set store to yes :
http://www.elasticsearch.org/guide/reference/mapping/core-types.html

Then, you will be able to get it back (but not as a partial document).

Thanks! How does it work for nested document. If I specify it on the
parent does it store all the child elements too?

HTH
David

Le 30 mai 2012 à 21:38, Mohit Anchlia mohitanchlia@gmail.com a écrit :

On Wed, May 30, 2012 at 12:23 PM, David Pilato david@pilato.fr wrote:

Don't store source.
http://www.elasticsearch.org/guide/reference/mapping/source-field.html

If I do store some portions of _source is it possible to fetch only few
fields instead of fetching all of them which seems to be the default?

Le 30 mai 2012 à 21:12, Mohit Anchlia mohitanchlia@gmail.com a écrit :

We are planning to index Json document that could be as big as 200K.
When user executes search we just want the matching doc id instead of the
entire documents. How can I just get the id of the Json document?


(jschelle) #8

You also use partial fields to tell it what to return. Passing an empty {} list will give you just the _id and _type fields.

http://www.elasticsearch.org/guide/reference/api/search/fields.html


(system) #9