Corresponding java call?


(Diptamay) #1

Hi All

Have a couple of questions:

  1. Could anyone tell me, whats the corresponding fieldQuery java api
    call for
    "field" : {
    "_all" : "jeter"
    }

in the query below?

{
"query" : {
"bool" : {
"must" : [
{
"field" : {
"_all" : "jeter"
}
},
{
"field" : {
"tags.subject.value" : "MLBCOM_TOP_PLAY"
}
}
],
"must_not" : {
"field" : {
"tags.subject.value" :
"MLBCOM_REALTIME_HIGHLIGHT"
}
}
}
},
"size" : 10
}

  1. Also
    "field" : {
    "_all" : "jeter"
    }
    would look for jeter in any of the fields in the documents right?

Thanks
Diptamay


(Shay Banon) #2

All queries can be constructed using the QueryBuilders static factory
methods (filters can be created using FilterBuilders).
QueryBuilders#fieldQuery is the one you are after.

-shay.banon

On Sat, Oct 30, 2010 at 6:22 AM, diptamay diptamay@gmail.com wrote:

Hi All

Have a couple of questions:

  1. Could anyone tell me, whats the corresponding fieldQuery java api
    call for
    "field" : {
    "_all" : "jeter"
    }

in the query below?

{
"query" : {
"bool" : {
"must" : [
{
"field" : {
"_all" : "jeter"
}
},
{
"field" : {
"tags.subject.value" : "MLBCOM_TOP_PLAY"
}
}
],
"must_not" : {
"field" : {
"tags.subject.value" :
"MLBCOM_REALTIME_HIGHLIGHT"
}
}
}
},
"size" : 10
}

  1. Also
    "field" : {
    "_all" : "jeter"
    }
    would look for jeter in any of the fields in the documents right?

Thanks
Diptamay


(Diptamay) #3

Thanks Shay,

Yes, I know of fieldQuery, but would specifying fieldQuery("_all",
value) search across all fields in the document, because I thought in
fieldQuery("fieldkey","value"), it would look for that specific
field.

Is my understanding wrong or fieldQuery("_all", value) will work for
me?

Thanks
Diptamay

On Oct 30, 3:01 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

All queries can be constructed using the QueryBuilders static factory
methods (filters can be created using FilterBuilders).
QueryBuilders#fieldQuery is the one you are after.

-shay.banon

On Sat, Oct 30, 2010 at 6:22 AM, diptamay dipta...@gmail.com wrote:

Hi All

Have a couple of questions:

  1. Could anyone tell me, whats the corresponding fieldQuery java api
    call for
    "field" : {
    "_all" : "jeter"
    }

in the query below?

{
"query" : {
"bool" : {
"must" : [
{
"field" : {
"_all" : "jeter"
}
},
{
"field" : {
"tags.subject.value" : "MLBCOM_TOP_PLAY"
}
}
],
"must_not" : {
"field" : {
"tags.subject.value" :
"MLBCOM_REALTIME_HIGHLIGHT"
}
}
}
},
"size" : 10
}

  1. Also
    "field" : {
    "_all" : "jeter"
    }
    would look for jeter in any of the fields in the documents right?

Thanks
Diptamay


(Shay Banon) #4

Yes, it will. The _all if a special field that includes all the other
fields.

-shay.banon

On Sat, Oct 30, 2010 at 9:43 PM, diptamay diptamay@gmail.com wrote:

Thanks Shay,

Yes, I know of fieldQuery, but would specifying fieldQuery("_all",
value) search across all fields in the document, because I thought in
fieldQuery("fieldkey","value"), it would look for that specific
field.

Is my understanding wrong or fieldQuery("_all", value) will work for
me?

Thanks
Diptamay

On Oct 30, 3:01 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

All queries can be constructed using the QueryBuilders static factory
methods (filters can be created using FilterBuilders).
QueryBuilders#fieldQuery is the one you are after.

-shay.banon

On Sat, Oct 30, 2010 at 6:22 AM, diptamay dipta...@gmail.com wrote:

Hi All

Have a couple of questions:

  1. Could anyone tell me, whats the corresponding fieldQuery java api
    call for
    "field" : {
    "_all" : "jeter"
    }

in the query below?

{
"query" : {
"bool" : {
"must" : [
{
"field" : {
"_all" : "jeter"
}
},
{
"field" : {
"tags.subject.value" : "MLBCOM_TOP_PLAY"
}
}
],
"must_not" : {
"field" : {
"tags.subject.value" :
"MLBCOM_REALTIME_HIGHLIGHT"
}
}
}
},
"size" : 10
}

  1. Also
    "field" : {
    "_all" : "jeter"
    }
    would look for jeter in any of the fields in the documents right?

Thanks
Diptamay


(Diptamay) #5

Shay, thanks for the help.

On Oct 30, 6:40 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Yes, it will. The _all if a special field that includes all the other
fields.

-shay.banon

On Sat, Oct 30, 2010 at 9:43 PM, diptamay dipta...@gmail.com wrote:

Thanks Shay,

Yes, I know of fieldQuery, but would specifying fieldQuery("_all",
value) search across all fields in the document, because I thought in
fieldQuery("fieldkey","value"), it would look for that specific
field.

Is my understanding wrong or fieldQuery("_all", value) will work for
me?

Thanks
Diptamay

On Oct 30, 3:01 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

All queries can be constructed using the QueryBuilders static factory
methods (filters can be created using FilterBuilders).
QueryBuilders#fieldQuery is the one you are after.

-shay.banon

On Sat, Oct 30, 2010 at 6:22 AM, diptamay dipta...@gmail.com wrote:

Hi All

Have a couple of questions:

  1. Could anyone tell me, whats the corresponding fieldQuery java api
    call for
    "field" : {
    "_all" : "jeter"
    }

in the query below?

{
"query" : {
"bool" : {
"must" : [
{
"field" : {
"_all" : "jeter"
}
},
{
"field" : {
"tags.subject.value" : "MLBCOM_TOP_PLAY"
}
}
],
"must_not" : {
"field" : {
"tags.subject.value" :
"MLBCOM_REALTIME_HIGHLIGHT"
}
}
}
},
"size" : 10
}

  1. Also
    "field" : {
    "_all" : "jeter"
    }
    would look for jeter in any of the fields in the documents right?

Thanks
Diptamay


(system) #6