AND query

Hi ,

My Data:

{
"programs":"Computer",
degreesAwarded:[
Bachelor,
Certificate,
Doctorate
],
"costTution":22977,
"isCoed":"Yes"
}

My Query:
I get results for below query
{
"query": {
"bool": {
"must": {
"match": {
"programs": "Computer",
}
}
}
}
}

But i want to find something like "programs": "Computer", AND "
degreesAwarded":"Bachelor" when i do that below i get exception ,
i could not find how to do a AND/OR query .
{
"query": {
"bool": {
"must": {
"match": {
"programs": "Computer",
"degreesAwarded":"Bachelor"
}
}
}
}
}

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

This worked for me
{
"query":{
"bool":{
"must":[
{
"match":{
"programs":"computer"
}
},
{
"match":{
"degreesAwarded":"Bachelor"
}
}
]
}
}
}

On Thursday, 21 November 2013 18:19:38 UTC+5:30, paul wrote:

Hi ,

My Data:

{
"programs":"Computer",
degreesAwarded:[
Bachelor,
Certificate,
Doctorate
],
"costTution":22977,
"isCoed":"Yes"
}

My Query:
I get results for below query
{
"query": {
"bool": {
"must": {
"match": {
"programs": "Computer",
}
}
}
}
}

But i want to find something like "programs": "Computer", AND "
degreesAwarded":"Bachelor" when i do that below i get exception ,
i could not find how to do a AND/OR query .
{
"query": {
"bool": {
"must": {
"match": {
"programs": "Computer",
"degreesAwarded":"Bachelor"
}
}
}
}
}

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

You should use filtered query I guess as your second clause sounds like to me as a filter!
Filters are cached.

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

Le 21 nov. 2013 à 15:30, paul avinashpaul85@gmail.com a écrit :

This worked for me
{
"query":{
"bool":{
"must":[
{
"match":{
"programs":"computer"
}
},
{
"match":{
"degreesAwarded":"Bachelor"
}
}
]
}
}
}

On Thursday, 21 November 2013 18:19:38 UTC+5:30, paul wrote:

Hi ,

My Data:

{
"programs":"Computer",
degreesAwarded:[
Bachelor,
Certificate,
Doctorate
],
"costTution":22977,
"isCoed":"Yes"
}

My Query:
I get results for below query
{
"query": {
"bool": {
"must": {
"match": {
"programs": "Computer",
}
}
}
}
}

But i want to find something like "programs": "Computer", AND "degreesAwarded":"Bachelor" when i do that below i get exception ,
i could not find how to do a AND/OR query .
{
"query": {
"bool": {
"must": {
"match": {
"programs": "Computer",
"degreesAwarded":"Bachelor"
}
}
}
}
}

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

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

Sure will look into filter query , thank you for the suggestion.

--
Paul

On Thursday, 21 November 2013 21:33:09 UTC+5:30, David Pilato wrote:

You should use filtered query I guess as your second clause sounds like to
me as a filter!
Filters are cached.

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

Le 21 nov. 2013 à 15:30, paul <avinas...@gmail.com <javascript:>> a
écrit :

This worked for me
{
"query":{
"bool":{
"must":[
{
"match":{
"programs":"computer"
}
},
{
"match":{
"degreesAwarded":"Bachelor"
}
}
]
}
}
}

On Thursday, 21 November 2013 18:19:38 UTC+5:30, paul wrote:

Hi ,

My Data:

{
"programs":"Computer",
degreesAwarded:[
Bachelor,
Certificate,
Doctorate
],
"costTution":22977,
"isCoed":"Yes"
}

My Query:
I get results for below query
{
"query": {
"bool": {
"must": {
"match": {
"programs": "Computer",
}
}
}
}
}

But i want to find something like "programs": "Computer", AND "
degreesAwarded":"Bachelor" when i do that below i get exception ,
i could not find how to do a AND/OR query .
{
"query": {
"bool": {
"must": {
"match": {
"programs": "Computer",
"degreesAwarded":"Bachelor"
}
}
}
}
}

--
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 elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

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