Top Hits for nested type field is not working..

2015-06-23 Thread Muddadi Hemaanusha
Hi,
Am using fields with nested type, in the mappings I kept for column1 and 
column2 as nested type fields..

I am using the following query to get the top hits:

GET partsfilter/partsfilter_type/_search
{
size: 10, 
 query : {
match : { description : abc }
},
aggs : {
column1 : {
nested : {
path : column1
},
aggs : {
   col1_agg:
   {
   terms:
   {
   field:column1.@key,
   size:0
   },
   aggs:
   {
   top:
   {
   top_hits:
   {
   size:1
   }
   }
   }
   }
}
}
}
}

This is throwing  *SearchPhaseExecutionException[Failed to execute phase 
[query]  exception. when* am removing top_hits aggs it is working fine.
how to write a top_hits query to work for the above case..

-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/1a55439f-5099-4cdc-9c8e-20866fd4533e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to search such values :- 1/2-12

2015-06-12 Thread Muddadi Hemaanusha
You can use prefix query hope so.

 query: {
  prefix: {
 *Data*: {
value: *1/2-12*
 }
  }
   }

On Thursday, June 4, 2015 at 6:39:10 PM UTC+5:30, Mohit Kumar Yadav wrote:

 Hello Folks,

 I have a such data


 *doc1 -  { Data : 1/2-12}*
 *doc2 -  { Data : 3/4-22}*
 *doc3 -  { Data : 1/8-42}*
 *doc4 -  { Data : 4/13-2}*
 *doc5 -  { Data : 13/24-27} *

 where data is mapped as a string. *{Data:{type:String}}*

 I am using following query for search :- 

 *{query_string: {query: Data:1\\/2\\\-12}}*

 but I am getting irrelevant response.
  
 Can you please suggest me some ways to track it..

 Thanks in advance...!!

 Thanks 
 Mohit




  

-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/d816ad10-2acc-4122-8d89-072a823df5b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Search for parts of a string array in elasticsearch

2015-06-12 Thread Muddadi Hemaanusha
Hi,

You can use terms query to match N number of values in field in different 
documents by,

{
terms : {
field : [ value1, value2, value3 ],
minimum_should_match : 3
}}

Here you can specify minimum should match, 
if you want only only value matched docs then 1 or else to match all the values 
matched docs keep as 3 or else only 2 values then keep 2.



On Wednesday, June 10, 2015 at 1:31:54 PM UTC+5:30, Vipin Sudhakar wrote:

 Hi, 

 I have a requirement, where i have to search for the filed 
 values(value1,value2 and value3) from elasticsearch. 

 But these values will be available from three differetn documents. 

 How can i make a ES query? 

 Currently i have single value for the filed and the query goes as below; 

 boolQueryBuilder.must(QueryBuilders.matchQuery(fieldName, 
value); 

 How shud i modify the query to suppor the array of string values 
 selection. 

 Thanks, 
 Sumitha. 




 -- 
 View this message in context: 
 http://elasticsearch-users.115913.n3.nabble.com/Search-for-parts-of-a-string-array-in-elasticsearch-tp4075074.html
  
 Sent from the Elasticsearch Users mailing list archive at Nabble.com. 


-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/78cd197d-d1cf-4891-a2b2-456aec1d8f1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Search for parts of a string array in elasticsearch

2015-06-12 Thread Muddadi Hemaanusha
This will be the equivalent API..

boolQueryBuilder.must(QueryBuilders.termsQuery(field, 
value1,value2,value3).minimumMatch(3));


On Friday, June 12, 2015 at 6:02:31 PM UTC+5:30, Muddadi Hemaanusha wrote:

 Hi,

 You can use terms query to match N number of values in field in different 
 documents by,

 {
 terms : {
 field : [ value1, value2, value3 ],
 minimum_should_match : 3
 }}

 Here you can specify minimum should match, 
 if you want only only value matched docs then 1 or else to match all the 
 values matched docs keep as 3 or else only 2 values then keep 2.



 On Wednesday, June 10, 2015 at 1:31:54 PM UTC+5:30, Vipin Sudhakar wrote:

 Hi, 

 I have a requirement, where i have to search for the filed 
 values(value1,value2 and value3) from elasticsearch. 

 But these values will be available from three differetn documents. 

 How can i make a ES query? 

 Currently i have single value for the filed and the query goes as below; 

 boolQueryBuilder.must(QueryBuilders.matchQuery(fieldName, 
value); 

 How shud i modify the query to suppor the array of string values 
 selection. 

 Thanks, 
 Sumitha. 




 -- 
 View this message in context: 
 http://elasticsearch-users.115913.n3.nabble.com/Search-for-parts-of-a-string-array-in-elasticsearch-tp4075074.html
  
 Sent from the Elasticsearch Users mailing list archive at Nabble.com. 



-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/fecfa130-7d2a-492d-b86e-9c782d8f40ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Can TopHits Size set to maximum using Java API..

2015-06-11 Thread Muddadi Hemaanusha
Hi ,

I would like to retrieve the tophits key all documents. Where we can 
retrieve all the keys by keeping the size :0 in terms query. But I would 
like to retrieve all documents for a key.

The Query am using:


GET filter_parts/filter_parts_type/_search
{
   size: 0, 
   query: {
   bool: {
   must: [
  {
  match: {
 PROPERTY1.@key: Dispensing Type
  }
  },
  {
  match: {
 PROPERTY1.@value: Pour
  }
  }
   ]
   }
   }, 
aggs:
{
value_Agg:
{
terms:
{
field:PROPERTY1.@value,
size:0
},
aggs:
{
top:
{
top_hits:
{
size:5
}
}
}
}
}

}


So with the key POUR the total number of documents count doc_count: 
1477, But as I set size of tophits to 5 am able to retrieve only 5 
documents How to set the size to Maximum or how to get all the records of 
that key..

Am using Java API to that is:

SearchResponse response = 
srb.addAggregation(AggregationBuilders.terms(value_Agg).field(PROPERTY1.@value).size(0).

subAggregation(AggregationBuilders.topHits(top).setSize(5))).execute().actionGet();
 
So how to set maximum size for topHits...?

-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/c2cf15c9-91bb-48d9-8791-a572c85ff8dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


match_phrase_prefix Java API ..

2015-06-05 Thread Muddadi Hemaanusha
Hi,

I would like to get the relevant JAVA API for the Query,

GET sayt/othermotive/_search
{
   query: {
  bool: {
 must: [
{
   match: {
  yearCode: {
 query: 2012,
 type: boolean
  }
   }
}, {
match : {
  modelCode : {
query : 1,
type : boolean
  }
}
}, {
match : {
  engineCode : {
query : 12,
type : boolean
  }
}
  }, {
term : {
  makeTypeCode : 3
}
  },
{
   

*match_phrase_prefix: {  
partDescription:a   }*
}
 ]
  }
   }
}

Am using a Java API as shown below:

*builder.must(QueryBuilders.matchPhrasePrefixQuery(partDescription, 
term));*

But this is building the query as

{
  query : {
bool : {
  must : [ {
match : {
  yearCode : {
query : 2012,
type : boolean
  }
}
  }, {
match : {
  makeCode : {
query : 143,
type : boolean
  }
}
  }, {
match : {
  modelCode : {
query : 1,
type : boolean
  }
}
  }, {
match : {
  engineCode : {
query : 12,
type : boolean
  }
}
  }, {
term : {
  makeTypeCode : 3
}
  }, {




*match : {  partDescription : {query : 
ac,type : phrase_prefix  }*
}
  } ]
}
  }
}


When I use this query am not getting result, When am using the query as I 
mention above with *match_phrase_prefix *it is giving the result

May I know the relevant Java API for match_phrase_prefix...

-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/1e008776-21db-4875-9b8a-ba58bfdf6f83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Java API Query for _all field in match:

2015-06-04 Thread Muddadi Hemaanusha
Hi Jason,

Thanks for your response , but I would like to build the query using 
matchQuery and I have done even settings with different analyzers and 
filters, I got the relevant query of Java API.

BoolQueryBuilder builder= boolQuery();
builder.must(QueryBuilders.matchQuery(_all, 
term).operator(MatchQueryBuilder.Operator.AND));


Thank You..

On Thursday, June 4, 2015 at 2:37:28 PM UTC+5:30, Jason Wee wrote:

 query = 
 filteredQuery(QueryBuilders.queryString(2000/sun).defaultOperator(and), 
 null);
 
 response = 
 client.prepareSearch(yemme).setTypes(ymmetype).setQuery(query).setSize(20).execute().actionGet();
 
 in query string, you might want to escape the slash as it means something 
 like the regex usage.

 es has moved to https://discuss.elastic.co/ , you should post your 
 question there.

 hth

 jason


 On Thursday, June 4, 2015 at 3:32:54 PM UTC+8, Muddadi Hemaanusha wrote:

 Hi,

 Am using a query :

 GET ymme/ymmetype/_search
 {
 size: 20, 
 query: {
match: {
_all:
{
query: 2000/sun ,
operator: and
}
}
 }
 }

 I would like to use the relevant query using Java API using query 
 builders,

 Can anyone post the Java API code to the above query



-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a886c363-15f1-4a9e-adc1-9975ef8f2078%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Analayzer of multi filed, multi word, match without query string.....

2015-06-03 Thread Muddadi Hemaanusha
Hi,

I would like to get the response including special characters in my query ,

1) I have seen using query string..  and my data sample is   :

*{ MakeCode: 2,  Year: 1987,  Model: APOLLO/SKYLARK,  
YearCode: 1987,  EngineCode: 3, Engine: 4-151  2.5L, 
ShortYear:87, Make: BUICK, ModelCode: 2*

when I have used querystring query

 GET ymme/ymmetype/_search
{
size: 50, 
query: {
bool: {
must: [
   
   {
   query_string: {

  query: 2 and APOLLO
   }
   }
]
}
}
}- Am getting response 


*If I query as:*

  query_string: {

  query: 2 and APOLLO/
   }
   }-  throwing SearchPhaseExecutionException[Failed to 
execute phase [query]

2) So How can I achieve query string to accept special characters like *('/', 
'-', '(', ')', ':' ,'.')* , is it possible with query string? if yes then 
which pattern I need I would like to know in detail..

3) Another approach also I have tried using index_name to keep all my 
required field data under that 'index_name' field  inorder to search using 
*match, 
match_phrase, match_phrase_prefix* filters by changing my mapping as shown 
below:

*Settings and mappings:*

PUT twitter1
{
settings: {
 
analysis: {
   analyzer: {
  wordAnalyzer: {
 type: custom,
 tokenizer: whitespace
  }
   }
}
 
  },
  mappings: {
  tweet1: {
   properties: {
   Engine: {
   index_name: name, 
  type: string
   },
   EngineCode: {
  type: string
   },
   Make: {
   index_name: name, 
  type: string
   },
   MakeCode: {
  type: string
   },
   Model: {
   index_name: name, 
  type: string
   },
   ModelCode: {
  type: string
   },
   ShortYear: {
   index_name: name, 
  type: string
   },
   Year: {
   index_name: name, 
  type: string
   },
   YearCode: {
  type: string
   }
}
 }
  }
}---name: Engine,Make,Model,ShortYear,Year

I tried the following queries with *match, match_phrase, 
match_phrase_prefix*:
using *match*

 query: {
 match: {
name: {
operator: and,
query: 85 m
}
 }
   }
This is not returning any records I tried with analyzer

GET twitter1/tweet1/_search
{
   size: 20,
   query: {
 match: {
name: {
operator: and,
query: 85 m,
analyzer: wordAnalyzer
}
 }
   }
}--- Then all the records are returning


using *match_phrase*:
query: {
  
 match_phrase: {
name: 85 m
 }
   }--- no records are returning, if name: 85 mazda ( 1 record) is 
returning

using *match_phrase_prefix*:
query: {
  
 match_phrase: {
name: 85 m
 }
   }--- returning 3 records with 85 and m combination i.e., 
ShortYear and Make

But when I used another combination like ShortYear and Engine
example:

query: {
  
 match_phrase_prefix: {
name: 85 v
 }
   } where Engine: V8-302  5.0L  (0 records are 
returning)


Any good approach to solve this problem such that the request may be at any 
word any combination the relevant records need to return. 
Can any one help me out to resolve this approach.

-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/191c7d96-eac9-4372-8b14-f7deba1724bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


elasticsearch-knapsack plugin for update settings throwing exception in main with Client

2015-05-29 Thread Muddadi Hemaanusha
Hi All,

Am using elasticsearch-knapsack plugin for update settings and for few 
other actions but am unable to start it , I just started using normal 
client creation as:

public class KnapSackImport {

private static Client client = null;

@Inject
public static Client getClient()
{
Client client = new TransportClient()
.addTransportAddress(new InetSocketTransportAddress(192.168.1.59, 
9300));
if(client!=null)
{
System.out.println(client);
}
return client;
}

public static void main(String args[])
{

getClient();

}
}


So when am running this am getting :


Exception in thread main 
org.elasticsearch.common.inject.CreationException: Guice creation errors:

1) No implementation for org.elasticsearch.cluster.ClusterService was bound.
  while locating org.elasticsearch.cluster.ClusterService
for parameter 1 at 
org.xbib.elasticsearch.knapsack.KnapsackService.init(Unknown Source)
  at 
org.xbib.elasticsearch.knapsack.KnapsackModule.configure(KnapsackModule.java:25)

2) A binding to org.xbib.elasticsearch.knapsack.KnapsackService was already 
configured at 
org.xbib.elasticsearch.knapsack.KnapsackModule.configure(KnapsackModule.java:25).
  at 
org.xbib.elasticsearch.knapsack.KnapsackModule.configure(KnapsackModule.java:25)

2 errors
at 
org.elasticsearch.common.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:344)
at 
org.elasticsearch.common.inject.InjectorBuilder.initializeStatically(InjectorBuilder.java:151)
at 
org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:102)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
at 
org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:59)
at 
org.elasticsearch.client.transport.TransportClient.init(TransportClient.java:187)
at 
org.elasticsearch.client.transport.TransportClient.init(TransportClient.java:115)
at com.knapsack.KnapSackImport.getClient(KnapSackImport.java:21)
at com.knapsack.KnapSackImport.main(KnapSackImport.java:33)


Can anyone trace this and tell me how to proceed with this ..

-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/21dfda1f-39b6-4706-b375-29a8977dab93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to perform Sum of a field to a group by data....

2015-04-01 Thread Muddadi Hemaanusha
Hi Team,

I would like to get the exact result of an SQL query 

select sum(Amount) from Emp group by (Name) Here If I take an example 
like

id  Name   amount
1   A1100
2   A2 200
3   A3 300
4   A1 200
5   A2 300

So for the above query the result will be Sum(Amount) by grouping the names 
A1, A2, A3 and for A1-- sum(100+200=300), A2--sum(200+300=500), 
A3--sum(300)...

For this query I have used the following equivalent query using 
Aggregations as shown below:

GET ABCD/_search
{
size: 0, 
   
  aggs: {
group_trans: {
  terms: {
field: trans
  },
  aggs: {
sum_ordamt:{
sum:{
field:ordamt
}
}
}
  }
}
  }

Am getting the result as:

aggregations: {
  group_trans: {
 doc_count_error_upper_bound: 81,
 sum_other_doc_count: 1371988,
 buckets: [
{
   key: 7ce2d738-5549-4da2-aed0-db939f3a9188,
   doc_count: 282,
   sum_ordamt: {
  value: 0
   }
},
{
   key: 8f4b187a-f321-4d25-bbc0-a9e78f5810b8,
   doc_count: 230,
   sum_ordamt: {
  value: 0
   }
},
{
   key: ca54db4c-620b-4650-bef6-350e83a0ca2c,
   doc_count: 170,
   sum_ordamt: {
  value: 0
   }
}
.
.
.
 ]
  }
   }
}   .Here Am getting sum 
value==0, May I know is there any way to Make a query relevant to the SQL 
query given above for to give the sum depending on the group by names... 

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/ab20bcf5-d573-431b-bb9e-7c1207109988%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to preserve special characters in search results of ElasticSearch.

2015-03-26 Thread Muddadi Hemaanusha
Hi Thanks, 

I resolved this issue, 

In order to preserve the special characters and to search the query term in 
multiple fields for exact match it is better to change the settings as 
shown below. 

Settings I updated: 

PUT /my_index/_settings?pretty=true 
{ 
settings : { 
analysis: { 
  analyzer: { 
wordAnalyzer: { 
  type: custom, 
  tokenizer: whitespace, 
  filter: [ 
word_delimiter_for_phone,nGram_filter 
  ] 
} 
  }, 
  filter: { 
word_delimiter_for_phone: { 
  type: word_delimiter, 
  catenate_all: true, 
  generate_number_parts : false, 
  split_on_case_change: false, 
  generate_word_parts: false, 
  split_on_numerics: false, 
  preserve_original: true 
}, 
  
nGram_filter: { 
   type: nGram, 
   min_gram: 1, 
   max_gram: 20, 
   token_chars: [ 
  letter 
   ] 
} 
  } 
} 
} 
} 


Mapping settings: 
{ 
“mappings”:{ 

   face : { 
 properties : { 
{field-1}id : { 
   type : string, 
   index_name : change, 
   analyzer: wordAnalyzer 

}, 
{field-2}name : { 
type : string, 
   index_name : change, 
   analyzer: wordAnalyzer 
}, 
{field-3}Year: 
{ 
type : string, 
   index_name : change, 
   analyzer: wordAnalyzer 
}, 
{field-4}Make: 
{ 
type : string, 
   index_name : change, 
   analyzer: wordAnalyzer 
} 
 } 
  } 



and the query we can use: 

GET my_index/face/_search 
{ 
   query: { 
   match: { 
  change: 
  { 
  query: A/T o, 
  type: phrase_prefix 
  } 
   } 
   } 
} 


By this we can search for that term in all the fields. In order to search 
in only single field we can give that field name in the place of change 
in match query. 

And for to change in mappings I am able to update the analyzers, but not 
the index_name, for to add index_name I have deleted the index and again 
done the mapping as above. 


On Tuesday, March 24, 2015 at 3:50:52 PM UTC+5:30, Muddadi Hemaanusha wrote:

 If I escape that character '/' I will get the data irrelevant to the 
 search term 

 eg: if a/b, a/c, a/d, a(b), a(c), a-b, ab  is my data

 My requirement is if I enter the term a( then I have to get only a( as a 
 result but not ab,a-b,...

 I would like to get the results without escaping them, the result need to 
 preserve the special character '/' , any query which is relevant to that 
 will be helpful and the search term need to search in different fields but 
 no need to match in all fields , any one field match result is required.

 On Monday, March 23, 2015 at 7:50:08 PM UTC+5:30, Periyandavar wrote:

 Hi 
  I think You need to escape those spl char in search string, like 
 { 
   query: { 
 bool: { 
   must: [ 
 { 
   query_string: { 
 fields: [ 
   msg 
 ], 
 query: a\\/ 
   } 
 } 
   ] 
 } 
   } 
 } 



 -- 
 View this message in context: 
 http://elasticsearch-users.115913.n3.nabble.com/Unable-to-preserve-special-characters-in-search-results-of-ElasticSearch-tp4072409p4072418.html
  
 Sent from the ElasticSearch Users mailing list archive at Nabble.com. 



-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/db074925-217f-48a9-8d19-6960282e4a7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to preserve special characters in search results of ElasticSearch.

2015-03-24 Thread Muddadi Hemaanusha
If I escape that character '/' I will get the data irrelevant to the search 
term 

eg: if a/b, a/c, a/d, a(b), a(c), a-b, ab  is my data

My requirement is if I enter the term a( then I have to get only a( as a 
result but not ab,a-b,...

I would like to get the results without escaping them, the result need to 
preserve the special character '/' , any query which is relevant to that 
will be helpful and the search term need to search in different fields but 
no need to match in all fields , any one field match result is required.

On Monday, March 23, 2015 at 7:50:08 PM UTC+5:30, Periyandavar wrote:

 Hi 
  I think You need to escape those spl char in search string, like 
 { 
   query: { 
 bool: { 
   must: [ 
 { 
   query_string: { 
 fields: [ 
   msg 
 ], 
 query: a\\/ 
   } 
 } 
   ] 
 } 
   } 
 } 



 -- 
 View this message in context: 
 http://elasticsearch-users.115913.n3.nabble.com/Unable-to-preserve-special-characters-in-search-results-of-ElasticSearch-tp4072409p4072418.html
  
 Sent from the ElasticSearch Users mailing list archive at Nabble.com. 


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/0c8b7093-5dae-4ea5-9b60-bf5353f6d985%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Query String query is not accepting analyzer which defined in settings..

2015-03-24 Thread Muddadi Hemaanusha
Hi Team,


I kept the following settings for an index facebook..

PUT /facebook
{
settings : {
analysis: {
  analyzer: {
wordAnalyzer: {
  type: custom,
  tokenizer: whitespace,
  filter: [
word_delimiter_for_phone
  ]
}
  },
  filter: {
word_delimiter_for_phone: {
  type: word_delimiter,
  catenate_all: true,
  generate_number_parts : false,
  split_on_case_change: false,
  generate_word_parts: false,
  split_on_numerics: false,
  preserve_original: true
}
  }
}
},
mapping:{
face: {
properties: {
   id: {
  type: string
   },
   name: {
  type: string
   }
}
 }
}
}

I would like to retrieve the data by preserving the special characters in 
the search term as it is, which is having special characters like -, /, ( , 
) ,
for this I have used the above analyzer and filter settings.

When am using query :

GET facebook/face/_search
{
  query: {
  
  bool: {
  must: [
 {
 query_string: {
fields: [
   id,name
],
query: a/,
analyzer:wordAnalyzer
 }
 }
  ]
  }
  }
  
}

Showing error as:

error: SearchPhaseExecutionException[Failed to execute phase [query], 
all shards failed; shardFailures {[0IYtu1aLQ2qxfwLnbCFTHg][facebook][0]: 
SearchParseException[[facebook][0]: from[-1],size[-1]: Parse Failure 
[Failed to parse source 

I would like to preserve the special characters while searching how can I 
achieve this?  do I need to change my query (or ) may I get any query to 
search the term in different fields by preserving the special characters.









-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/eb395416-f991-45c7-b24b-960438f2d625%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Unable to preserve special characters in search results of ElasticSearch.

2015-03-23 Thread Muddadi Hemaanusha
Hi, 

I want to preserve the special characters like -, /, (, ) in search 
results. 

Ex: Abc/def a(bc)def a-bcd 
response:  If I enter Abc/ the records containing abc/ need to come, 
similarly for abc/def records with the following need to come, in the same 
way abc/def a(bc) records with the similar combination need to come. 


For this I have used different analyzers and filters and the settings and 
mappings as follows: 

PUT /facebook?pretty=true 
{ 
settings : { 
analysis : { 
filter : { 
special_character_spliter : { 
type : word_delimiter, 
preserve_original: true 
}   
}, 
analyzer : { 
my_an : { 
type : pattern, 
pattern : [^(*\/*-*\\w\\p{L}]+, 
tokenizer : whitespace, 
filter : [ special_character_spliter] 
} 
} 
} 
}, 
 mappings : { 
face : { 
properties : { 
msg : { 
type : string, 
analyzer: my_an 

}, 
name : { 
type : string 
} 
} 
} 
} 
} 



and even I have tried with the following settings also: 

PUT facebook?pretty=true 
{ 
settings: { 
index.number_of_replicas: 0, 
analysis: { 
analyzer: { 
msg_excp_analyzer: { 
type: custom, 
tokenizer: whitespace, 
filters: [my_word_delimiter,my_word_pattern, 
lowercase, 
asciifolding, 
shingle, 
standard] 
} 
}, 
filters: { 
my_word_pattern: 
{ 
   type : pattern_capture, 
   preserve_original : 1, 
   patterns : [ 
  (\\w+), 
  (\\p{L}+), 
  (\\d+), 
  @(.+) 
   ] 

}, 
my_word_delimiter: { 
type: word_delimiter, 
preserve_original: true, 
  catenate_all: true, 
  type_table: { 
$: DIGIT, 
%: DIGIT, 
.: DIGIT, 
,: DIGIT, 
:: DIGIT, 
/: DIGIT, 
\\: DIGIT, 
=: DIGIT, 
: DIGIT, 
(: DIGIT, 
): DIGIT, 
: DIGIT, 
: DIGIT, 
\\U+000A: DIGIT 

}, 
my_asciifolding: { 
type: asciifolding, 
preserve_original: true 
} 
} 
} 
} 
}, 
mappings: { 
face: { 
properties: { 
msg: { 
type: string, 
index: analyzed, 
analyzer: msg_excp_analyzer 
}, 
name: { 
type: string, 
index: analyzed, 
analyzer: msg_excp_analyzer 
} 
} 
} 
} 
} 


With above settings I have tried separately inorder to preserve the special 
characters in search results, 
and i have used query like: 

GET facebook/face/_search 
{ 

   query: { 
  bool: { 
  must: [ 
 { 
 query_string: { 
fields: [ 
   msg 
], 
query: a/ 
 } 
 } 
  ] 
  } 

} 
} 


Am getting the following error: 

error: SearchPhaseExecutionException[Failed to execute phase [query], 
all shards failed; shardFailures {[trVZmtb4Qu-QWIqxK5hEfg][facebook][0]: 
SearchParseException[[facebook][0]: 


May I know what is the problem with , whether is it with my query or 
settings? 

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a33a7559-3a09-4c24-a8a7-101d6e9fbda0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Special Characters not indexed and hence not searchable

2015-03-20 Thread Muddadi Hemaanusha
Am using the pattern [^@:\/\.\!\=\-\\w\\p{L}\\d]+ in sense for settings. 
It is showing showing Bad string sytax error. Do I need to add anything for 
this pattern inorder to accept the string in sense. 
Where I would like to add special characters like'-','/','(',')' to my 
pattern.. 


Here is my settings:
 analysis: { 
analyzer: {
 my_analyzer:
 {
 type:custom,
 tokenizer:special_tokenizer,
 filter   : [mynGram]
 }
},
tokenizer: {
special_tokenizer:
{
type : pattern,
pattern : 
[^-\/\\w\\p{L}\\d]+ Here am 
getting Bad String syntax error in sense , any other way of giving the 
string
}
},
filter: {
  mynGram : {
  type: nGram,
  min_gram: 1,
  max_gram: 50
  }
}

}

On Thursday, July 26, 2012 at 11:58:46 PM UTC+5:30, Praveen Kariyanahalli 
wrote:

 I saw many threads discuss it. I have crossed few hurdles, last one is 
 still bothering me. I had email address, :, / in my data (which need to 
 be indexed and searched). Now I am able to search the email address 
 te...@myco.com javascript:, *but I still cannot have the following 
 characters indexed: : / and -*. Any help is greatly appreciated. Is 
 it issue with my index_analyzer or search_analyzer? 

 Thanks in Advance
 -Praveen

 Here is my mapping:

 ESINDEX =   {
 number_of_shards: 1,
 analysis: {
filter: {
   mynGram : {
   type: nGram,
   min_gram: 1,
   max_gram: 50
   }
 },
 analyzer: {
 a1 : {
 type :custom,
 tokenizer:uax_url_email,
 filter   : [mynGram]
 }
 }
 }
 }


 ESMAPPINGS = {
 index_analyzer  : a1,
 search_analyzer : whitespace,
 properties : {
 u'test_field1' : {
 'index'  : 'not_analyzed',
 'type'   : u'string',
 'store'  : 'yes'
 },
 u'testfield2' : {
 'index'  : 'not_analyzed',
 'type'   : u'string',
 'store'  : 'yes'
 },
 u'email' : {
 'index': 'not_analyzed',
 'type' : u'string',
 'store': 'yes'
 },
 :::
 }


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/c431b584-a4a2-4b86-89ce-b9cce43d3e79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.