Java API fieldQuery

Hi, I am currently using the Java API for ES with MongoDB. I use fieldQuery
for my main search functionality, where I look for a substring within a
particular field. However, I have one particular document whose value of
"To To " does not return successfully when I search for it. I had verified
that it did exist in the index by searching for it via it's ID. Is this
because "To" is a keyword? Here is the code I am using:

SearchResponse response = client.prepareSearch("mongoindex")

    .setSearchType(SearchType.*QUERY_AND_FETCH*)

    .setQuery(*fieldQuery*(field, "\""+value+"\""))

    .setFrom(0).setSize(60).setExplain(*true*)

    .execute()

    .actionGet();

--

You are using the default analyzer which remove english stop words, such as "a",
"to"...

That's the reason.

Le 21 janvier 2013 à 10:50, Wei Hao Tan tanweihao88@gmail.com a écrit :

Hi, I am currently using the Java API for ES with MongoDB. I use fieldQuery
for my main search functionality, where I look for a substring within a
particular field. However, I have one particular document whose value of "To
To " does not return successfully when I search for it. I had verified that it
did exist in the index by searching for it via it's ID. Is this because "To"
is a keyword? Here is the code I am using:

SearchResponse response = client.prepareSearch("mongoindex")

     .setSearchType(SearchType.QUERY_AND_FETCH)

     .setQuery(fieldQuery(field, "\""+value+"\""))

     .setFrom(0).setSize(60).setExplain(true)

     .execute()

     .actionGet();

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

Hi David,

I see! Thanks for the help! If that's the case, how do I change the
analyzer to include the default stop words?

On Monday, January 21, 2013 6:30:21 PM UTC+8, David Pilato wrote:

You are using the default analyzer which remove english stop words, such
as "a", "to"...

That's the reason.

Le 21 janvier 2013 à 10:50, Wei Hao Tan <tanwe...@gmail.com <javascript:>>
a écrit :

Hi, I am currently using the Java API for ES with MongoDB. I use
fieldQuery for my main search functionality, where I look for a substring
within a particular field. However, I have one particular document whose
value of "To To " does not return successfully when I search for it. I had
verified that it did exist in the index by searching for it via it's ID. Is
this because "To" is a keyword? Here is the code I am using:

SearchResponse response = client.prepareSearch("mongoindex")

    .setSearchType(SearchType.*QUERY_AND_FETCH*)

    .setQuery(*fieldQuery*(field, "\""+value+"\""))

    .setFrom(0).setSize(60).setExplain(*true*)

    .execute()

    .actionGet();

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

I managed to figure it out, thanks to these two very informative links!
http://elasticsearch-users.115913.n3.nabble.com/I-am-tired-of-continuously-trying-to-override-the-default-analyzer-and-tokanizer-settings-td3350150.html

On Monday, January 21, 2013 11:23:46 PM UTC+8, Wei Hao Tan wrote:

Hi David,

I see! Thanks for the help! If that's the case, how do I change the
analyzer to include the default stop words?

On Monday, January 21, 2013 6:30:21 PM UTC+8, David Pilato wrote:

You are using the default analyzer which remove english stop words,
such as "a", "to"...

That's the reason.

Le 21 janvier 2013 à 10:50, Wei Hao Tan tanwe...@gmail.com a écrit :

Hi, I am currently using the Java API for ES with MongoDB. I use
fieldQuery for my main search functionality, where I look for a substring
within a particular field. However, I have one particular document whose
value of "To To " does not return successfully when I search for it. I had
verified that it did exist in the index by searching for it via it's ID. Is
this because "To" is a keyword? Here is the code I am using:

SearchResponse response = client.prepareSearch("mongoindex")

    .setSearchType(SearchType.*QUERY_AND_FETCH*)

    .setQuery(*fieldQuery*(field, "\""+value+"\""))

    .setFrom(0).setSize(60).setExplain(*true*)

    .execute()

    .actionGet();

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--