Remove white spaces when using XContentBuilder

Hello sir
I want to remove whitespaces and using trim()

             XContentBuilder builder = XContentFactory.jsonBuilder()
                    .startObject();

builder.field("From", emails.get(i).from.trim());

but find :Exception in thread "main" java.lang.NullPointerException
and also Node not created

============================================================

On Mon, Feb 18, 2013 at 4:36 PM, MUKESH PANDEY mukeshp073@gmail.com wrote:

Thanks sir for support

====================================================================

On Mon, Feb 18, 2013 at 1:52 PM, David Pilato david@pilato.fr wrote:

Prefix filter is not analyzed. See
Elasticsearch Platform — Find real-time answers at scale | Elastic

So, if you want to use it here, use it with a Capital N

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 18 févr. 2013 à 09:20, MUKESH PANDEY mukeshp073@gmail.com a écrit :

yes i have CurrentLocation:Navi Mumbai
ok i have change CurrentLocation:delhi but
i think when we using prefixFilter than match with "null" if
no any match found and should return result so My question still same why
Filter not working when comments out than find result

{
"took" : 31,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
} so please suggest me how to search on the basis of skills and
location with java api?

On Mon, Feb 18, 2013 at 12:24 PM, David Pilato david@pilato.fr wrote:

Do you have a document with CurrentLocation=n ?

Hard to say something else as we don't know your mapping either your
docs.

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

Le 18 févr. 2013 à 07:00, MUKESH PANDEY mukeshp073@gmail.com a écrit :

I have already facing same problem

Settings settings = ImmutableSettings.settingsBuilder().put("
cluster.name", "elasticsearch").build();
Client client = new
TransportClient(settings).addTransportAddress(new
InetSocketTransportAddress("192.168.1.16", 9300));

client.admin().indices().prepareRefresh("resume_index").execute().actionGet();
FilterBuilders.andFilter(
FilterBuilders.prefixFilter("keyskil", "asp"),
FilterBuilders.prefixFilter("CurrentLocation", "delhi")
);
AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("keyskil",
"asp"));

queryFilters.add(FilterBuilders.prefixFilter("CurrentLocation", "n"));
FilterBuilder aggFilter =
FilterBuilders.andFilter(queryFilters);
SearchResponse response =
client.prepareSearch("resume_index")

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
//.setFilter(aggFilter)

//.setQuery(QueryBuilders.termQuery("KeySkills", "red"))

//.setQuery(QueryBuilders.prefixQuery("CurrentLocation","n"))
.setFrom(0)
.setSize(2)
.setExplain(true)
.execute()
.actionGet();

        System.out.println(response.toString());
        String s=response.toString();

find result:

{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 261,
"max_score" : 1.0,
"hits" : [ {
"_shard" : 0,
"_node" : "Gik4Z040QSSzsNRlS9sVew",
"_index" : "resume_index",
"type" : "emls",
"_id" : "<
CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.comhttp://cafv6cm-puautlfv-udvtxhvydhov61vyql5wdxafiglmbykclail.com/

",
"_score" : 1.0, "_source" : {"From":"ajay.singh@com","Subject":"Fwd:
check file parser","Path":"E:\emls\output\ajacom.lalituttam_129.doc
","ResumeHeadline":"asp.net developerhaving 2 year and 5 months
experience ","KeySkills":"ASP.Net http://asp.net/ & C#.NetWith
SQLServer 2005 ","Name":"saris kumar gupta ","TotalExperience":"2 Years, 1
Months ","CTC":"Rs1.45 lacs ","CurrentEmployer":"IAP Company Limited
","CurrentDesignation":"SoftwareProgrammer
","LastEmployer":null,"LastDesignation":null,"CurrentLocation":null,"PreferredLocation":null,"Education":"B.A,
MCA ","Mobile":"7388852980 ","Landline":"91-- ","Recommendations":"Not
Mentioned ","Lastmodifiedon":"14-Mar-2012 "},
"_explanation" : {
"value" : 1.0,
"description" : "ConstantScore(NotDeleted(:)), product of:",
"details" : [ {
"value" : 1.0,
"description" : "boost"
}, {
"value" : 1.0,
"description" : "queryNorm"
} ]
}
}, {............................

but when //.setFilter(aggFilter) comments out then find result

{
"took" : 16,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
} please let me know whats the error? I want search on basis of multiple
filed..

============================================================================

On Wednesday, February 1, 2012 3:10:11 PM UTC+5:30, kimchy wrote:

Its probably because the title is analyzed, so its broken down into
(modified) terms, for example, "Person template" will be broken down into
two tokens, "person" and "template". When you use term filter, it only
works on actual tokens. You can have the title not analyzed in the mapping
(or use a multi field mapping that has it both as analyzed and
not_analyzed) and then filter on the not analyzed version of it.

On Wednesday, February 1, 2012 at 2:35 AM, Ariel Mendoza wrote:

Hi Shay,

I am using AndFilterBuilder. Here are the results when setFilter(fb)
is commented-out.

Search 'Person': took 68ms, shards 1:0
hit: 0.220823 test_db1/template/CrmPerson(**ver 1)
hit: 0.220823 test_db1/template/CrmCompany(**ver 1)
hit: 0.126185 test_db1/Person/W2.7(ver 1)
hit: 0.126185 test_db1/Person/W2.8(ver 1)
hit: 0.126185 test_db1/Person/W2.9(ver 1)
hit: 0.126185 test_db1/Person/W2.10(ver 1)
hit: 0.126185 test_db1/Person/W2.11(ver 1)
hit: 0.126185 test_db1/Person/W2.12(ver 1)
hit: 0.126185 test_db1/Person/W2.13(ver 1)
hit: 0.126185 test_db1/Person/W2.14(ver 1)

{"title":"Person template","desc":"Person template","path":"/
test_db1/template/CrmPerson"**,"version":1},{"title":"Person
template","desc":"Person template","path":"/test_db1/**template/
CrmCompany","version":1},{"**title":"Steven Boutte","desc":"Contacts
person document containing details of Steven Boutte","path":"/
test_db1/Person/W2.7","**version":1},{"title":"Joe
Hunter","desc":"Contacts person document containing details of Joe
Hunter","path":"/test_db1/**Person/W2.8","version":1},
{"title":"Joseph Wells","desc":"Contacts person document containing
details of Joseph Wells","path":"/test_db1/Person/W2.9","version":
1},{"title":"Albert Brown","desc":"Contacts person document containing
details of Albert Brown","path":"/test_db1/

Person/W2.10","version":
1},{"title":"Mike Rivera","desc":"Contacts person document containing
details of Mike Rivera","path":"/test_db1/**Person/W2.11","version":
1},{"title":"Sandra Hohl","desc":"Contacts person document containing
details of Sandra Hohl","path":"/test_db1/**Person/W2.12","version":
1},{"title":"Curt Adamski","desc":"Contacts person document c
ontaining details of Curt Adamski","path":"/test_db1/**Person/
W2.13","version":1},{"title":"**Darlene Quandt","desc":"Contacts person
document containing details of Darlene Quandt","path":"/test_db1/
Person/W2.14","version":1}

From the results above, I would like to filter those with title =
"Person template" or version = 1. But, I fail to do so provided the
codes below:

QueryBuilder qb =
QueryBuilders.queryString("**Person");

AndFilterBuilder myFilters =
FilterBuilders.andFilter();
//
myFilters.add(FilterBuilders.**termFilter("version", "1"));
myFilters.add(FilterBuilders.**termFilter("title", "Person
template"));

// QueryBuilder qb =
QueryBuilders.filteredQuery(**QueryBuilders.queryString(**query),
myFilters);

// QueryBuilder qb =
QueryBuilders.filteredQuery(**QueryBuilders.queryString(**query),
// FilterBuilders.queryFilter( ... ));

searchResponse = client.prepareSearch(dbName)
.setSearchType(SearchType.**QUERY_THEN_FETCH)
.setQuery(qb)
.setFilter(myFilters)
.setVersion(true)
.setFrom(start)
.setSize(size)
// .setExplain(true) // Explain hit score
// .setNoFields() // Do not return
stored fields
.addField("document.title")
.addField("document.desc")
.execute()
.actionGet();

Thanks,
Ariel

On Feb 1, 1:42 am, Shay Banon kim...@gmail.com wrote:

Really hard to help without knowing what filter you use, the data you
index, and how its mapped...

On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:

I am using Java API for text search. Refer to the codes below, when I
execute it, no record is retrieve though the Filter parameters of
field and value pair I've set are correct, but when I comment-out or
remove the .setFilter(fb), the search works fine. Please let me know
if I'm doing this wrong or are there other approach to achieve my
goal?

searchResponse = client.prepareSearch(dbName)
.setSearchType(SearchType.**QUERY_THEN_FETCH)
.setQuery(qb)
.setFilter(fb)
.setVersion(true)
.setFrom(start)
.setSize(size)
// .setExplain(true) // Explain hit score
// .setNoFields() // Do not return
stored fields
.addField("document.title")
.addField("document.desc")
.execute()
.actionGet();

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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

The NPE is probably in your code:
emails.get(i).from.trim()

This is not relative to Elasticsearch.

That said, why do you think you need to remove white spaces?

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

Le 19 févr. 2013 à 06:19, MUKESH PANDEY mukeshp073@gmail.com a écrit :

Hello sir
I want to remove whitespaces and using trim()

             XContentBuilder builder = XContentFactory.jsonBuilder()
                    .startObject();

builder.field("From", emails.get(i).from.trim());

but find :Exception in thread "main" java.lang.NullPointerException
and also Node not created

============================================================

On Mon, Feb 18, 2013 at 4:36 PM, MUKESH PANDEY mukeshp073@gmail.com wrote:

Thanks sir for support

====================================================================

On Mon, Feb 18, 2013 at 1:52 PM, David Pilato david@pilato.fr wrote:

Prefix filter is not analyzed. See Elasticsearch Platform — Find real-time answers at scale | Elastic

So, if you want to use it here, use it with a Capital N

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 18 févr. 2013 à 09:20, MUKESH PANDEY mukeshp073@gmail.com a écrit :

yes i have CurrentLocation:Navi Mumbai
ok i have change CurrentLocation:delhi but
i think when we using prefixFilter than match with "null" if no any match found and should return result so My question still same why Filter not working when comments out than find result

{
"took" : 31,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
} so please suggest me how to search on the basis of skills and location with java api?

On Mon, Feb 18, 2013 at 12:24 PM, David Pilato david@pilato.fr wrote:

Do you have a document with CurrentLocation=n ?

Hard to say something else as we don't know your mapping either your docs.

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

Le 18 févr. 2013 à 07:00, MUKESH PANDEY mukeshp073@gmail.com a écrit :

I have already facing same problem

Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "elasticsearch").build();
Client client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress("192.168.1.16", 9300));
client.admin().indices().prepareRefresh("resume_index").execute().actionGet();
FilterBuilders.andFilter(
FilterBuilders.prefixFilter("keyskil", "asp"),
FilterBuilders.prefixFilter("CurrentLocation", "delhi")
);
AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("keyskil", "asp"));
queryFilters.add(FilterBuilders.prefixFilter("CurrentLocation", "n"));
FilterBuilder aggFilter = FilterBuilders.andFilter(queryFilters);
SearchResponse response = client.prepareSearch("resume_index")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
//.setFilter(aggFilter)
//.setQuery(QueryBuilders.termQuery("KeySkills", "red"))
//.setQuery(QueryBuilders.prefixQuery("CurrentLocation","n"))
.setFrom(0)
.setSize(2)
.setExplain(true)
.execute()
.actionGet();

        System.out.println(response.toString());
        String s=response.toString();

find result:

{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 261,
"max_score" : 1.0,
"hits" : [ {
"_shard" : 0,
"_node" : "Gik4Z040QSSzsNRlS9sVew",
"_index" : "resume_index",
"type" : "emls",
"_id" : "<CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.com>",
"_score" : 1.0, "_source" : {"From":"ajay.singh@com","Subject":"Fwd: check file parser","Path":"E:\emls\output\ajacom.lalituttam_129.doc","ResumeHeadline":"asp.net developerhaving 2 year and 5 months experience ","KeySkills":"ASP.Net & C#.NetWith SQLServer 2005 ","Name":"saris kumar gupta ","TotalExperience":"2 Years, 1 Months ","CTC":"Rs1.45 lacs ","CurrentEmployer":"IAP Company Limited ","CurrentDesignation":"SoftwareProgrammer ","LastEmployer":null,"LastDesignation":null,"CurrentLocation":null,"PreferredLocation":null,"Education":"B.A, MCA ","Mobile":"7388852980 ","Landline":"91-- ","Recommendations":"Not Mentioned ","Lastmodifiedon":"14-Mar-2012 "},
"_explanation" : {
"value" : 1.0,
"description" : "ConstantScore(NotDeleted(:)), product of:",
"details" : [ {
"value" : 1.0,
"description" : "boost"
}, {
"value" : 1.0,
"description" : "queryNorm"
} ]
}
}, {............................

but when //.setFilter(aggFilter) comments out then find result

{
"took" : 16,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
} please let me know whats the error? I want search on basis of multiple filed..

On Wednesday, February 1, 2012 3:10:11 PM UTC+5:30, kimchy wrote:

Its probably because the title is analyzed, so its broken down into (modified) terms, for example, "Person template" will be broken down into two tokens, "person" and "template". When you use term filter, it only works on actual tokens. You can have the title not analyzed in the mapping (or use a multi field mapping that has it both as analyzed and not_analyzed) and then filter on the not analyzed version of it.
On Wednesday, February 1, 2012 at 2:35 AM, Ariel Mendoza wrote:

Hi Shay,

I am using AndFilterBuilder. Here are the results when setFilter(fb)
is commented-out.

Search 'Person': took 68ms, shards 1:0
hit: 0.220823 test_db1/template/CrmPerson(ver 1)
hit: 0.220823 test_db1/template/CrmCompany(ver 1)
hit: 0.126185 test_db1/Person/W2.7(ver 1)
hit: 0.126185 test_db1/Person/W2.8(ver 1)
hit: 0.126185 test_db1/Person/W2.9(ver 1)
hit: 0.126185 test_db1/Person/W2.10(ver 1)
hit: 0.126185 test_db1/Person/W2.11(ver 1)
hit: 0.126185 test_db1/Person/W2.12(ver 1)
hit: 0.126185 test_db1/Person/W2.13(ver 1)
hit: 0.126185 test_db1/Person/W2.14(ver 1)

{"title":"Person template","desc":"Person template","path":"/
test_db1/template/CrmPerson","version":1},{"title":"Person
template","desc":"Person template","path":"/test_db1/template/
CrmCompany","version":1},{"title":"Steven Boutte","desc":"Contacts
person document containing details of Steven Boutte","path":"/
test_db1/Person/W2.7","version":1},{"title":"Joe
Hunter","desc":"Contacts person document containing details of Joe
Hunter","path":"/test_db1/Person/W2.8","version":1},
{"title":"Joseph Wells","desc":"Contacts person document containing
details of Joseph Wells","path":"/test_db1/Person/W2.9","version":
1},{"title":"Albert Brown","desc":"Contacts person document containing
details of Albert Brown","path":"/test_db1/Person/W2.10","version":
1},{"title":"Mike Rivera","desc":"Contacts person document containing
details of Mike Rivera","path":"/test_db1/Person/W2.11","version":
1},{"title":"Sandra Hohl","desc":"Contacts person document containing
details of Sandra Hohl","path":"/test_db1/Person/W2.12","version":
1},{"title":"Curt Adamski","desc":"Contacts person document c
ontaining details of Curt Adamski","path":"/test_db1/Person/
W2.13","version":1},{"title":"Darlene Quandt","desc":"Contacts person
document containing details of Darlene Quandt","path":"/test_db1/
Person/W2.14","version":1}

From the results above, I would like to filter those with title =
"Person template" or version = 1. But, I fail to do so provided the
codes below:

QueryBuilder qb =
QueryBuilders.queryString("Person");

AndFilterBuilder myFilters =
FilterBuilders.andFilter();
//
myFilters.add(FilterBuilders.termFilter("version", "1"));
myFilters.add(FilterBuilders.termFilter("title", "Person template"));

// QueryBuilder qb =
QueryBuilders.filteredQuery(QueryBuilders.queryString(query),
myFilters);

// QueryBuilder qb =
QueryBuilders.filteredQuery(QueryBuilders.queryString(query),
// FilterBuilders.queryFilter( ... ));

searchResponse = client.prepareSearch(dbName)
.setSearchType(SearchType.QUERY_THEN_FETCH)
.setQuery(qb)
.setFilter(myFilters)
.setVersion(true)
.setFrom(start)
.setSize(size)
// .setExplain(true) // Explain hit score
// .setNoFields() // Do not return
stored fields
.addField("document.title")
.addField("document.desc")
.execute()
.actionGet();

Thanks,
Ariel

On Feb 1, 1:42 am, Shay Banon kim...@gmail.com wrote:

Really hard to help without knowing what filter you use, the data you index, and how its mapped...

On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:

I am using Java API for text search. Refer to the codes below, when I
execute it, no record is retrieve though the Filter parameters of
field and value pair I've set are correct, but when I comment-out or
remove the .setFilter(fb), the search works fine. Please let me know
if I'm doing this wrong or are there other approach to achieve my
goal?

searchResponse = client.prepareSearch(dbName)
.setSearchType(SearchType.QUERY_THEN_FETCH)
.setQuery(qb)
.setFilter(fb)
.setVersion(true)
.setFrom(start)
.setSize(size)
// .setExplain(true) // Explain hit score
// .setNoFields() // Do not return
stored fields
.addField("document.title")
.addField("document.desc")
.execute()
.actionGet();

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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.

This is my json

{
.....
"Education":" BCA","CurrentDesignation":" BCA",
"LastEmployer":" Ait",
"LastDesignation":" Developer",
"CurrentLocation":" Delhi",
"PreferredLocation":"Pune",
"Mobile": 88888...,
"Landline":" NotMentioned",
"Recommendations":" Not Mentioned",
"Lastmodifiedon":"11-Feb-2013"}}]}}

and when i search with
AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("Education", "B"));

It will not give any Hits...but get Hits results only where value have no
any whitespaces and its value in Lowercase

=================================================================

On Tue, Feb 19, 2013 at 12:13 PM, David Pilato david@pilato.fr wrote:

The NPE is probably in your code:
emails.get(i).from.trim()

This is not relative to Elasticsearch.

That said, why do you think you need to remove white spaces?

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

Le 19 févr. 2013 à 06:19, MUKESH PANDEY mukeshp073@gmail.com a écrit :

Hello sir
I want to remove whitespaces and using trim()

             XContentBuilder builder = XContentFactory.jsonBuilder()
                    .startObject();

builder.field("From", emails.get(i).from.trim());

but find :Exception in thread "main" java.lang.NullPointerException
and also Node not created

============================================================

On Mon, Feb 18, 2013 at 4:36 PM, MUKESH PANDEY mukeshp073@gmail.comwrote:

Thanks sir for support

====================================================================

On Mon, Feb 18, 2013 at 1:52 PM, David Pilato david@pilato.fr wrote:

Prefix filter is not analyzed. See
Elasticsearch Platform — Find real-time answers at scale | Elastic

So, if you want to use it here, use it with a Capital N

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 18 févr. 2013 à 09:20, MUKESH PANDEY mukeshp073@gmail.com a écrit :

yes i have CurrentLocation:Navi Mumbai
ok i have change CurrentLocation:delhi but
i think when we using prefixFilter than match with "null" if
no any match found and should return result so My question still same why
Filter not working when comments out than find result

{
"took" : 31,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
} so please suggest me how to search on the basis of skills and
location with java api?

On Mon, Feb 18, 2013 at 12:24 PM, David Pilato david@pilato.fr wrote:

Do you have a document with CurrentLocation=n ?

Hard to say something else as we don't know your mapping either your
docs.

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

Le 18 févr. 2013 à 07:00, MUKESH PANDEY mukeshp073@gmail.com a
écrit :

I have already facing same problem

Settings settings = ImmutableSettings.settingsBuilder().put("
cluster.name", "elasticsearch").build();
Client client = new
TransportClient(settings).addTransportAddress(new
InetSocketTransportAddress("192.168.1.16", 9300));

client.admin().indices().prepareRefresh("resume_index").execute().actionGet();
FilterBuilders.andFilter(
FilterBuilders.prefixFilter("keyskil", "asp"),
FilterBuilders.prefixFilter("CurrentLocation", "delhi")
);
AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("keyskil",
"asp"));

queryFilters.add(FilterBuilders.prefixFilter("CurrentLocation", "n"));
FilterBuilder aggFilter =
FilterBuilders.andFilter(queryFilters);
SearchResponse response =
client.prepareSearch("resume_index")

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
//.setFilter(aggFilter)

//.setQuery(QueryBuilders.termQuery("KeySkills", "red"))

//.setQuery(QueryBuilders.prefixQuery("CurrentLocation","n"))
.setFrom(0)
.setSize(2)
.setExplain(true)
.execute()
.actionGet();

        System.out.println(response.toString());
        String s=response.toString();

find result:

{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 261,
"max_score" : 1.0,
"hits" : [ {
"_shard" : 0,
"_node" : "Gik4Z040QSSzsNRlS9sVew",
"_index" : "resume_index",
"type" : "emls",
"_id" : "<
CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.comhttp://cafv6cm-puautlfv-udvtxhvydhov61vyql5wdxafiglmbykclail.com/

",
"_score" : 1.0, "_source" : {"From":"ajay.singh@com","Subject":"Fwd:
check file parser","Path":"E:\emls\output\ajacom.lalituttam_129.doc
","ResumeHeadline":"asp.net developerhaving 2 year and 5 months
experience ","KeySkills":"ASP.Net http://asp.net/ & C#.NetWith
SQLServer 2005 ","Name":"saris kumar gupta ","TotalExperience":"2 Years, 1
Months ","CTC":"Rs1.45 lacs ","CurrentEmployer":"IAP Company Limited
","CurrentDesignation":"SoftwareProgrammer
","LastEmployer":null,"LastDesignation":null,"CurrentLocation":null,"PreferredLocation":null,"Education":"B.A,
MCA ","Mobile":"7388852980 ","Landline":"91-- ","Recommendations":"Not
Mentioned ","Lastmodifiedon":"14-Mar-2012 "},
"_explanation" : {
"value" : 1.0,
"description" : "ConstantScore(NotDeleted(:)), product of:",
"details" : [ {
"value" : 1.0,
"description" : "boost"
}, {
"value" : 1.0,
"description" : "queryNorm"
} ]
}
}, {............................

but when //.setFilter(aggFilter) comments out then find result

{
"took" : 16,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
} please let me know whats the error? I want search on basis of
multiple filed..

============================================================================

On Wednesday, February 1, 2012 3:10:11 PM UTC+5:30, kimchy wrote:

Its probably because the title is analyzed, so its broken down into
(modified) terms, for example, "Person template" will be broken down into
two tokens, "person" and "template". When you use term filter, it only
works on actual tokens. You can have the title not analyzed in the mapping
(or use a multi field mapping that has it both as analyzed and
not_analyzed) and then filter on the not analyzed version of it.

On Wednesday, February 1, 2012 at 2:35 AM, Ariel Mendoza wrote:

Hi Shay,

I am using AndFilterBuilder. Here are the results when setFilter(fb)
is commented-out.

Search 'Person': took 68ms, shards 1:0
hit: 0.220823 test_db1/template/CrmPerson(**ver 1)
hit: 0.220823 test_db1/template/CrmCompany(**ver 1)
hit: 0.126185 test_db1/Person/W2.7(ver 1)
hit: 0.126185 test_db1/Person/W2.8(ver 1)
hit: 0.126185 test_db1/Person/W2.9(ver 1)
hit: 0.126185 test_db1/Person/W2.10(ver 1)
hit: 0.126185 test_db1/Person/W2.11(ver 1)
hit: 0.126185 test_db1/Person/W2.12(ver 1)
hit: 0.126185 test_db1/Person/W2.13(ver 1)
hit: 0.126185 test_db1/Person/W2.14(ver 1)

{"title":"Person template","desc":"Person template","path":"/
test_db1/template/CrmPerson"**,"version":1},{"title":"Person
template","desc":"Person template","path":"/test_db1/template/
CrmCompany","version":1},{"title":"Steven Boutte","desc":"Contacts
person document containing details of Steven Boutte","path":"/
test_db1/Person/W2.7","version":1},{"title":"Joe
Hunter","desc":"Contacts person document containing details of Joe
Hunter","path":"/test_db1/Person/W2.8","version":1},
{"title":"Joseph Wells","desc":"Contacts person document containing
details of Joseph Wells","path":"/test_db1/

Person/W2.9","version":
1},{"title":"Albert Brown","desc":"Contacts person document containing
details of Albert Brown","path":"/test_db1/

Person/W2.10","version":
1},{"title":"Mike Rivera","desc":"Contacts person document containing
details of Mike Rivera","path":"/test_db1/

Person/W2.11","version":
1},{"title":"Sandra Hohl","desc":"Contacts person document containing
details of Sandra Hohl","path":"/test_db1/

Person/W2.12","version":
1},{"title":"Curt Adamski","desc":"Contacts person document c
ontaining details of Curt Adamski","path":"/test_db1/**Person/
W2.13","version":1},{"title":"**Darlene Quandt","desc":"Contacts
person
document containing details of Darlene Quandt","path":"/test_db1/
Person/W2.14","version":1}

From the results above, I would like to filter those with title =
"Person template" or version = 1. But, I fail to do so provided the
codes below:

QueryBuilder qb =
QueryBuilders.queryString("**Person");

AndFilterBuilder myFilters =
FilterBuilders.andFilter();
//
myFilters.add(FilterBuilders.**termFilter("version", "1"));
myFilters.add(FilterBuilders.**termFilter("title", "Person
template"));

// QueryBuilder qb =
QueryBuilders.filteredQuery(**QueryBuilders.queryString(**query),
myFilters);

// QueryBuilder qb =
QueryBuilders.filteredQuery(**QueryBuilders.queryString(**query),
// FilterBuilders.queryFilter( ... ));

searchResponse = client.prepareSearch(dbName)
.setSearchType(SearchType.**QUERY_THEN_FETCH)
.setQuery(qb)
.setFilter(myFilters)
.setVersion(true)
.setFrom(start)
.setSize(size)
// .setExplain(true) // Explain hit score
// .setNoFields() // Do not return
stored fields
.addField("document.title")
.addField("document.desc")
.execute()
.actionGet();

Thanks,
Ariel

On Feb 1, 1:42 am, Shay Banon kim...@gmail.com wrote:

Really hard to help without knowing what filter you use, the data you
index, and how its mapped...

On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:

I am using Java API for text search. Refer to the codes below, when I
execute it, no record is retrieve though the Filter parameters of
field and value pair I've set are correct, but when I comment-out or
remove the .setFilter(fb), the search works fine. Please let me know
if I'm doing this wrong or are there other approach to achieve my
goal?

searchResponse = client.prepareSearch(dbName)
.setSearchType(SearchType.**QUERY_THEN_FETCH)
.setQuery(qb)
.setFilter(fb)
.setVersion(true)
.setFrom(start)
.setSize(size)
// .setExplain(true) // Explain hit score
// .setNoFields() // Do not return
stored fields
.addField("document.title")
.addField("document.desc")
.execute()
.actionGet();

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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

What do you want to achieve here? Autocomplete?

What you should do is to find the right analyzer that fit your needs.
If you need to do some autocomplete, have a look at EdgeNgram tokenizer: Elasticsearch Platform — Find real-time answers at scale | Elastic

You can build your own analyzer using custom analyzer: Elasticsearch Platform — Find real-time answers at scale | Elastic
You can define in this analyzer to break your tokens with a whitespace tokenizer Elasticsearch Platform — Find real-time answers at scale | Elastic or a standard tokenizer Elasticsearch Platform — Find real-time answers at scale | Elastic

It really depends on your use case.

What could help here to answer is to have a better idea of your use case and a full curl recreation (as a Gist).
See Elasticsearch Platform — Find real-time answers at scale | Elastic

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 19 févr. 2013 à 09:00, MUKESH PANDEY mukeshp073@gmail.com a écrit :

This is my json

{
.....
"Education":" BCA","CurrentDesignation":" BCA",
"LastEmployer":" Ait",
"LastDesignation":" Developer",
"CurrentLocation":" Delhi",
"PreferredLocation":"Pune",
"Mobile": 88888...,
"Landline":" NotMentioned",
"Recommendations":" Not Mentioned",
"Lastmodifiedon":"11-Feb-2013"}}]}}

and when i search with
AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("Education", "B"));

It will not give any Hits...but get Hits results only where value have no any whitespaces and its value in Lowercase

=================================================================

On Tue, Feb 19, 2013 at 12:13 PM, David Pilato david@pilato.fr wrote:
The NPE is probably in your code:
emails.get(i).from.trim()

This is not relative to Elasticsearch.

That said, why do you think you need to remove white spaces?

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

Le 19 févr. 2013 à 06:19, MUKESH PANDEY mukeshp073@gmail.com a écrit :

Hello sir
I want to remove whitespaces and using trim()

             XContentBuilder builder = XContentFactory.jsonBuilder()
                    .startObject();

builder.field("From", emails.get(i).from.trim());

but find :Exception in thread "main" java.lang.NullPointerException
and also Node not created

============================================================

On Mon, Feb 18, 2013 at 4:36 PM, MUKESH PANDEY mukeshp073@gmail.com wrote:
Thanks sir for support

====================================================================

On Mon, Feb 18, 2013 at 1:52 PM, David Pilato david@pilato.fr wrote:
Prefix filter is not analyzed. See Elasticsearch Platform — Find real-time answers at scale | Elastic

So, if you want to use it here, use it with a Capital N

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 18 févr. 2013 à 09:20, MUKESH PANDEY mukeshp073@gmail.com a écrit :

yes i have CurrentLocation:Navi Mumbai
ok i have change CurrentLocation:delhi but
i think when we using prefixFilter than match with "null" if no any match found and should return result so My question still same why Filter not working when comments out than find result

{
"took" : 31,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
} so please suggest me how to search on the basis of skills and location with java api?

On Mon, Feb 18, 2013 at 12:24 PM, David Pilato david@pilato.fr wrote:
Do you have a document with CurrentLocation=n ?

Hard to say something else as we don't know your mapping either your docs.

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

Le 18 févr. 2013 à 07:00, MUKESH PANDEY mukeshp073@gmail.com a écrit :

I have already facing same problem

Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "elasticsearch").build();
Client client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress("192.168.1.16", 9300));
client.admin().indices().prepareRefresh("resume_index").execute().actionGet();
FilterBuilders.andFilter(
FilterBuilders.prefixFilter("keyskil", "asp"),
FilterBuilders.prefixFilter("CurrentLocation", "delhi")
);
AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("keyskil", "asp"));
queryFilters.add(FilterBuilders.prefixFilter("CurrentLocation", "n"));
FilterBuilder aggFilter = FilterBuilders.andFilter(queryFilters);
SearchResponse response = client.prepareSearch("resume_index")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
//.setFilter(aggFilter)
//.setQuery(QueryBuilders.termQuery("KeySkills", "red"))
//.setQuery(QueryBuilders.prefixQuery("CurrentLocation","n"))
.setFrom(0)
.setSize(2)
.setExplain(true)
.execute()
.actionGet();

        System.out.println(response.toString());
        String s=response.toString();

find result:

{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 261,
"max_score" : 1.0,
"hits" : [ {
"_shard" : 0,
"_node" : "Gik4Z040QSSzsNRlS9sVew",
"_index" : "resume_index",
"type" : "emls",
"_id" : "<CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.com>",
"_score" : 1.0, "_source" : {"From":"ajay.singh@com","Subject":"Fwd: check file parser","Path":"E:\emls\output\ajacom.lalituttam_129.doc","ResumeHeadline":"asp.net developerhaving 2 year and 5 months experience ","KeySkills":"ASP.Net & C#.NetWith SQLServer 2005 ","Name":"saris kumar gupta ","TotalExperience":"2 Years, 1 Months ","CTC":"Rs1.45 lacs ","CurrentEmployer":"IAP Company Limited ","CurrentDesignation":"SoftwareProgrammer ","LastEmployer":null,"LastDesignation":null,"CurrentLocation":null,"PreferredLocation":null,"Education":"B.A, MCA ","Mobile":"7388852980 ","Landline":"91-- ","Recommendations":"Not Mentioned ","Lastmodifiedon":"14-Mar-2012 "},
"_explanation" : {
"value" : 1.0,
"description" : "ConstantScore(NotDeleted(:)), product of:",
"details" : [ {
"value" : 1.0,
"description" : "boost"
}, {
"value" : 1.0,
"description" : "queryNorm"
} ]
}
}, {............................

but when //.setFilter(aggFilter) comments out then find result

{
"took" : 16,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
} please let me know whats the error? I want search on basis of multiple filed..

On Wednesday, February 1, 2012 3:10:11 PM UTC+5:30, kimchy wrote:
Its probably because the title is analyzed, so its broken down into (modified) terms, for example, "Person template" will be broken down into two tokens, "person" and "template". When you use term filter, it only works on actual tokens. You can have the title not analyzed in the mapping (or use a multi field mapping that has it both as analyzed and not_analyzed) and then filter on the not analyzed version of it.
On Wednesday, February 1, 2012 at 2:35 AM, Ariel Mendoza wrote:

Hi Shay,

I am using AndFilterBuilder. Here are the results when setFilter(fb)
is commented-out.

Search 'Person': took 68ms, shards 1:0
hit: 0.220823 test_db1/template/CrmPerson(ver 1)
hit: 0.220823 test_db1/template/CrmCompany(ver 1)
hit: 0.126185 test_db1/Person/W2.7(ver 1)
hit: 0.126185 test_db1/Person/W2.8(ver 1)
hit: 0.126185 test_db1/Person/W2.9(ver 1)
hit: 0.126185 test_db1/Person/W2.10(ver 1)
hit: 0.126185 test_db1/Person/W2.11(ver 1)
hit: 0.126185 test_db1/Person/W2.12(ver 1)
hit: 0.126185 test_db1/Person/W2.13(ver 1)
hit: 0.126185 test_db1/Person/W2.14(ver 1)

{"title":"Person template","desc":"Person template","path":"/
test_db1/template/CrmPerson","version":1},{"title":"Person
template","desc":"Person template","path":"/test_db1/template/
CrmCompany","version":1},{"title":"Steven Boutte","desc":"Contacts
person document containing details of Steven Boutte","path":"/
test_db1/Person/W2.7","version":1},{"title":"Joe
Hunter","desc":"Contacts person document containing details of Joe
Hunter","path":"/test_db1/Person/W2.8","version":1},
{"title":"Joseph Wells","desc":"Contacts person document containing
details of Joseph Wells","path":"/test_db1/Person/W2.9","version":
1},{"title":"Albert Brown","desc":"Contacts person document containing
details of Albert Brown","path":"/test_db1/Person/W2.10","version":
1},{"title":"Mike Rivera","desc":"Contacts person document containing
details of Mike Rivera","path":"/test_db1/Person/W2.11","version":
1},{"title":"Sandra Hohl","desc":"Contacts person document containing
details of Sandra Hohl","path":"/test_db1/Person/W2.12","version":
1},{"title":"Curt Adamski","desc":"Contacts person document c
ontaining details of Curt Adamski","path":"/test_db1/Person/
W2.13","version":1},{"title":"Darlene Quandt","desc":"Contacts person
document containing details of Darlene Quandt","path":"/test_db1/
Person/W2.14","version":1}

From the results above, I would like to filter those with title =
"Person template" or version = 1. But, I fail to do so provided the
codes below:

QueryBuilder qb =
QueryBuilders.queryString("Person");

AndFilterBuilder myFilters =
FilterBuilders.andFilter();
//
myFilters.add(FilterBuilders.termFilter("version", "1"));
myFilters.add(FilterBuilders.termFilter("title", "Person template"));

// QueryBuilder qb =
QueryBuilders.filteredQuery(QueryBuilders.queryString(query),
myFilters);

// QueryBuilder qb =
QueryBuilders.filteredQuery(QueryBuilders.queryString(query),
// FilterBuilders.queryFilter( ... ));

searchResponse = client.prepareSearch(dbName)
.setSearchType(SearchType.QUERY_THEN_FETCH)
.setQuery(qb)
.setFilter(myFilters)
.setVersion(true)
.setFrom(start)
.setSize(size)
// .setExplain(true) // Explain hit score
// .setNoFields() // Do not return
stored fields
.addField("document.title")
.addField("document.desc")
.execute()
.actionGet();

Thanks,
Ariel

On Feb 1, 1:42 am, Shay Banon kim...@gmail.com wrote:

Really hard to help without knowing what filter you use, the data you index, and how its mapped...

On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:

I am using Java API for text search. Refer to the codes below, when I
execute it, no record is retrieve though the Filter parameters of
field and value pair I've set are correct, but when I comment-out or
remove the .setFilter(fb), the search works fine. Please let me know
if I'm doing this wrong or are there other approach to achieve my
goal?

searchResponse = client.prepareSearch(dbName)
.setSearchType(SearchType.QUERY_THEN_FETCH)
.setQuery(qb)
.setFilter(fb)
.setVersion(true)
.setFrom(start)
.setSize(size)
// .setExplain(true) // Explain hit score
// .setNoFields() // Do not return
stored fields
.addField("document.title")
.addField("document.desc")
.execute()
.actionGet();

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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

Hello sir
I want to search on the behalf of CurrentLocation and
its Education from jsp page ....issues is that:

   String cl=getCurrentLocation(); Here we find the value of

currentlocation

1-..setQuery(QueryBuilders.prefixQuery("CurrentLocation",
getCurrentLocation())) but here not getting the value ....
Please Let me know, can we change the value at run time or
not ?

===============================================================
On Tue, Feb 19, 2013 at 9:52 PM, David Pilato david@pilato.fr wrote:

What do you want to achieve here? Autocomplete?

What you should do is to find the right analyzer that fit your needs.
If you need to do some autocomplete, have a look at EdgeNgram tokenizer:
Elasticsearch Platform — Find real-time answers at scale | Elastic

You can build your own analyzer using custom analyzer:
Elasticsearch Platform — Find real-time answers at scale | Elastic
You can define in this analyzer to break your tokens with a whitespace
tokenizer
Elasticsearch Platform — Find real-time answers at scale | Elastic or
a standard tokenizer
Elasticsearch Platform — Find real-time answers at scale | Elastic

It really depends on your use case.

What could help here to answer is to have a better idea of your use case
and a full curl recreation (as a Gist).
See Elasticsearch Platform — Find real-time answers at scale | Elastic

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 19 févr. 2013 à 09:00, MUKESH PANDEY mukeshp073@gmail.com a écrit :

This is my json

{
.....
"Education":" BCA","CurrentDesignation":" BCA",
"LastEmployer":" Ait",
"LastDesignation":" Developer",
"CurrentLocation":" Delhi",
"PreferredLocation":"Pune",
"Mobile": 88888...,
"Landline":" NotMentioned",
"Recommendations":" Not Mentioned",
"Lastmodifiedon":"11-Feb-2013"}}]}}

and when i search with
AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("Education",
"B"));

It will not give any Hits...but get Hits results only where value have no
any whitespaces and its value in Lowercase

=================================================================

On Tue, Feb 19, 2013 at 12:13 PM, David Pilato david@pilato.fr wrote:

The NPE is probably in your code:
emails.get(i).from.trim()

This is not relative to Elasticsearch.

That said, why do you think you need to remove white spaces?

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

Le 19 févr. 2013 à 06:19, MUKESH PANDEY mukeshp073@gmail.com a écrit :

Hello sir
I want to remove whitespaces and using trim()

             XContentBuilder builder = XContentFactory.jsonBuilder()
                    .startObject();

builder.field("From", emails.get(i).from.trim());

but find :Exception in thread "main" java.lang.NullPointerException
and also Node not created

============================================================

On Mon, Feb 18, 2013 at 4:36 PM, MUKESH PANDEY mukeshp073@gmail.comwrote:

Thanks sir for support

====================================================================

On Mon, Feb 18, 2013 at 1:52 PM, David Pilato david@pilato.fr wrote:

Prefix filter is not analyzed. See
Elasticsearch Platform — Find real-time answers at scale | Elastic

So, if you want to use it here, use it with a Capital N

--
David Pilato | Technical Advocate | *Elasticsearch.comhttp://elasticsearch.com/
*
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 18 févr. 2013 à 09:20, MUKESH PANDEY mukeshp073@gmail.com a écrit
:

yes i have CurrentLocation:Navi Mumbai
ok i have change CurrentLocation:delhi but
i think when we using prefixFilter than match with "null"
if no any match found and should return result so My question still same
why Filter not working when comments out than find result

{
"took" : 31,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
} so please suggest me how to search on the basis of skills and
location with java api?

On Mon, Feb 18, 2013 at 12:24 PM, David Pilato david@pilato.fr wrote:

Do you have a document with CurrentLocation=n ?

Hard to say something else as we don't know your mapping either your
docs.

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

Le 18 févr. 2013 à 07:00, MUKESH PANDEY mukeshp073@gmail.com a
écrit :

I have already facing same problem

Settings settings = ImmutableSettings.settingsBuilder().put("
cluster.name", "elasticsearch").build();
Client client = new
TransportClient(settings).addTransportAddress(new
InetSocketTransportAddress("192.168.1.16", 9300));

client.admin().indices().prepareRefresh("resume_index").execute().actionGet();
FilterBuilders.andFilter(
FilterBuilders.prefixFilter("keyskil", "asp"),
FilterBuilders.prefixFilter("CurrentLocation", "delhi")
);
AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("keyskil",
"asp"));

queryFilters.add(FilterBuilders.prefixFilter("CurrentLocation", "n"));
FilterBuilder aggFilter =
FilterBuilders.andFilter(queryFilters);
SearchResponse response =
client.prepareSearch("resume_index")

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
//.setFilter(aggFilter)

//.setQuery(QueryBuilders.termQuery("KeySkills", "red"))

//.setQuery(QueryBuilders.prefixQuery("CurrentLocation","n"))
.setFrom(0)
.setSize(2)
.setExplain(true)
.execute()
.actionGet();

        System.out.println(response.toString());
        String s=response.toString();

find result:

{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 261,
"max_score" : 1.0,
"hits" : [ {
"_shard" : 0,
"_node" : "Gik4Z040QSSzsNRlS9sVew",
"_index" : "resume_index",
"type" : "emls",
"_id" : "<
CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.comhttp://cafv6cm-puautlfv-udvtxhvydhov61vyql5wdxafiglmbykclail.com/

",
"_score" : 1.0, "_source" : {"From":"ajay.singh@com","Subject":"Fwd:
check file parser","Path":"E:\emls\output\ajacom.lalituttam_129.doc
","ResumeHeadline":"asp.net developerhaving 2 year and 5 months
experience ","KeySkills":"ASP.Net http://asp.net/ & C#.NetWith
SQLServer 2005 ","Name":"saris kumar gupta ","TotalExperience":"2 Years, 1
Months ","CTC":"Rs1.45 lacs ","CurrentEmployer":"IAP Company Limited
","CurrentDesignation":"SoftwareProgrammer
","LastEmployer":null,"LastDesignation":null,"CurrentLocation":null,"PreferredLocation":null,"Education":"B.A,
MCA ","Mobile":"7388852980 ","Landline":"91-- ","Recommendations":"Not
Mentioned ","Lastmodifiedon":"14-Mar-2012 "},
"_explanation" : {
"value" : 1.0,
"description" : "ConstantScore(NotDeleted(:)), product of:",
"details" : [ {
"value" : 1.0,
"description" : "boost"
}, {
"value" : 1.0,
"description" : "queryNorm"
} ]
}
}, {............................

but when //.setFilter(aggFilter) comments out then find result

{
"took" : 16,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
} please let me know whats the error? I want search on basis of
multiple filed..

============================================================================

On Wednesday, February 1, 2012 3:10:11 PM UTC+5:30, kimchy wrote:

Its probably because the title is analyzed, so its broken down into
(modified) terms, for example, "Person template" will be broken down into
two tokens, "person" and "template". When you use term filter, it only
works on actual tokens. You can have the title not analyzed in the mapping
(or use a multi field mapping that has it both as analyzed and
not_analyzed) and then filter on the not analyzed version of it.

On Wednesday, February 1, 2012 at 2:35 AM, Ariel Mendoza wrote:

Hi Shay,

I am using AndFilterBuilder. Here are the results when setFilter(fb)
is commented-out.

Search 'Person': took 68ms, shards 1:0
hit: 0.220823 test_db1/template/CrmPerson(**ver 1)
hit: 0.220823 test_db1/template/CrmCompany(**ver 1)
hit: 0.126185 test_db1/Person/W2.7(ver 1)
hit: 0.126185 test_db1/Person/W2.8(ver 1)
hit: 0.126185 test_db1/Person/W2.9(ver 1)
hit: 0.126185 test_db1/Person/W2.10(ver 1)
hit: 0.126185 test_db1/Person/W2.11(ver 1)
hit: 0.126185 test_db1/Person/W2.12(ver 1)
hit: 0.126185 test_db1/Person/W2.13(ver 1)
hit: 0.126185 test_db1/Person/W2.14(ver 1)

{"title":"Person template","desc":"Person template","path":"/
test_db1/template/CrmPerson"**,"version":1},{"title":"Person
template","desc":"Person template","path":"/test_db1/template/
CrmCompany","version":1},{"title":"Steven Boutte","desc":"Contacts
person document containing details of Steven Boutte","path":"/
test_db1/Person/W2.7","version":1},{"title":"Joe
Hunter","desc":"Contacts person document containing details of Joe
Hunter","path":"/test_db1/Person/W2.8","version":1},
{"title":"Joseph Wells","desc":"Contacts person document containing
details of Joseph Wells","path":"/test_db1/

Person/W2.9","version":
1},{"title":"Albert Brown","desc":"Contacts person document containing
details of Albert Brown","path":"/test_db1/

Person/W2.10","version":
1},{"title":"Mike Rivera","desc":"Contacts person document containing
details of Mike Rivera","path":"/test_db1/

Person/W2.11","version":
1},{"title":"Sandra Hohl","desc":"Contacts person document containing
details of Sandra Hohl","path":"/test_db1/

Person/W2.12","version":
1},{"title":"Curt Adamski","desc":"Contacts person document c
ontaining details of Curt Adamski","path":"/test_db1/**Person/
W2.13","version":1},{"title":"**Darlene Quandt","desc":"Contacts
person
document containing details of Darlene Quandt","path":"/test_db1/
Person/W2.14","version":1}

From the results above, I would like to filter those with title =
"Person template" or version = 1. But, I fail to do so provided the
codes below:

QueryBuilder qb =
QueryBuilders.queryString("**Person");

AndFilterBuilder myFilters =
FilterBuilders.andFilter();
//
myFilters.add(FilterBuilders.**termFilter("version", "1"));
myFilters.add(FilterBuilders.**termFilter("title", "Person
template"));

// QueryBuilder qb =
QueryBuilders.filteredQuery(**QueryBuilders.queryString(**query),
myFilters);

// QueryBuilder qb =
QueryBuilders.filteredQuery(**QueryBuilders.queryString(**query),
// FilterBuilders.queryFilter( ... ));

searchResponse = client.prepareSearch(dbName)
.setSearchType(SearchType.**QUERY_THEN_FETCH)
.setQuery(qb)
.setFilter(myFilters)
.setVersion(true)
.setFrom(start)
.setSize(size)
// .setExplain(true) // Explain hit score
// .setNoFields() // Do not return
stored fields
.addField("document.title")
.addField("document.desc")
.execute()
.actionGet();

Thanks,
Ariel

On Feb 1, 1:42 am, Shay Banon kim...@gmail.com wrote:

Really hard to help without knowing what filter you use, the data you
index, and how its mapped...

On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:

I am using Java API for text search. Refer to the codes below, when I
execute it, no record is retrieve though the Filter parameters of
field and value pair I've set are correct, but when I comment-out or
remove the .setFilter(fb), the search works fine. Please let me know
if I'm doing this wrong or are there other approach to achieve my
goal?

searchResponse = client.prepareSearch(dbName)
.setSearchType(SearchType.**QUERY_THEN_FETCH)
.setQuery(qb)
.setFilter(fb)
.setVersion(true)
.setFrom(start)
.setSize(size)
// .setExplain(true) // Explain hit score
// .setNoFields() // Do not return
stored fields
.addField("document.title")
.addField("document.desc")
.execute()
.actionGet();

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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

--
mukeshp073@gmail.com
Laitkor.infosolution pvt ltd

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