Best approach to pull back only relevant fields

If I have a document I’m storing that looks like this:

doc = {

userId: *‘*yoyomamma',
physicians: [{
name: "sanjay gupta",
id: 403494
},
{
name: "daniel litvak",
id: 3382
}],
procedures: [{
name: "appendectomy",
id: 3939,
date: "2/3/2012"
}

… etc a bunch of other stuff

}

When I search on “appendectomy” I want to only return the following:
“userId” and the matching “procedures” fields…..

Any thoughts on the best approach to do this?

thanks

phil

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGenvhVDwZdS8519af5RWisrEVVUbeOi55%2BUdGZNK55mwsLzNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

It somehow means to me that you are searching for procedures so you should index procedures not doc.

If you need both, you could may be use Parent/child feature so you will have different docs indexed.

My 2 cents

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 5 janv. 2015 à 22:50, phil swenson phil.swenson@gmail.com a écrit :

If I have a document I’m storing that looks like this:

doc = {

userId: ‘yoyomamma',
physicians: [{
name: "sanjay gupta",
id: 403494
},
{
name: "daniel litvak",
id: 3382
}],
procedures: [{
name: "appendectomy",
id: 3939,
date: "2/3/2012"
}
… etc a bunch of other stuff
}
When I search on “appendectomy” I want to only return the following: “userId” and the matching “procedures” fields…..

Any thoughts on the best approach to do this?

thanks
phil

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGenvhVDwZdS8519af5RWisrEVVUbeOi55%2BUdGZNK55mwsLzNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/00357F51-A710-4973-B428-FAAF6B17E5CB%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.