Failed to search given search data using elastic java api?


(Sam-4) #1

Hi

I'm using elastic search-0.16.2 server.my search string "09Q2 SR
Website Whitepaper: TrustedSource: The Next Generation Reputation
System for".i got following error:

Caused by:
org.elasticsearch.transport.NotSerializableTransportException:
[org.elasticsearch.search.SearchParseException] [114648][2]:
from[-1],size[-1]: Parse Failure [Failed to parse source [:slight_smile:
??ery??ery_string??9Q2 SR Website Whitepaper: TrustedSource: The
Next Generation Reputation System for??elds?countName??]]; [114648]
Failed to parse query [09Q2 SR Website Whitepaper: TrustedSource: The
Next Generation Reputation System for]; Cannot parse '09Q2 SR Website
Whitepaper: TrustedSource: The Next Generation Reputation System
for': Encountered " ":" ": "" at line 1, column 42.
Was expecting one of:

...
...
...
"+" ...
"-" ...
"(" ...
"" ...
"^" ...
...
...
<FUZZY_SLOP> ...
...
...
"[" ...
"{" ...
...
; Encountered " ":" ": "" at line 1, column 42.
Was expecting one of:

...
...
...
"+" ...
"-" ...
"(" ...
"
" ...
"^" ...
...
...
<FUZZY_SLOP> ...
...
...
"[" ...
"{" ...
...
;
DEBUG - [Dracula] [114648][3], node[GzlwvpEgRQGpSjJuDErklQ], [P],
s[STARTED]: Failed to execute
[org.elasticsearch.action.search.SearchRequest@cfb11f]
org.elasticsearch.transport.RemoteTransportException: [Corruptor]
[inet[/192.168.1.100:9302]][search/phase/query]
Caused by:
org.elasticsearch.transport.NotSerializableTransportException:
[org.elasticsearch.search.SearchParseException] [114648][3]:
from[-1],size[-1]: Parse Failure [Failed to parse source [:slight_smile:
??ery??ery_string??9Q2 SR Website Whitepaper: TrustedSource: The
Next Generation Reputation System for??elds?countName??]]; [114648]
Failed to parse query [09Q2 SR Website Whitepaper: TrustedSource: The
Next Generation Reputation System for]; Cannot parse '09Q2 SR Website
Whitepaper: TrustedSource: The Next Generation Reputation System
for': Encountered " ":" ": "" at line 1, column 42.
Was expecting one of:

...
...
...
"+" ...
"-" ...
"(" ...
"" ...
"^" ...
...
...
<FUZZY_SLOP> ...
...
...
"[" ...
"{" ...
...
; Encountered " ":" ": "" at line 1, column 42.
Was expecting one of:

...
...
...
"+" ...
"-" ...
"(" ...
"
" ...
"^" ...
...
...
<FUZZY_SLOP> ...
...
...
"[" ...
"{" ...
...
;

please tell me what is problem in there?Is elastic having any search
string limitation or character limitation.

I''m using the following methods to get results:

SearchResponse searchResponse = client.prepareSearch(indexName)
.setSearchType(SearchType.DEFAULT).setTypes(indexType)
.setQuery(queryString(data).field(indexColumn))
.execute()
.actionGet();

Thanks


(Clinton Gormley) #2

Hi Sam

I'm using elastic search-0.16.2 server.my search string "09Q2 SR
Website Whitepaper: TrustedSource: The Next Generation Reputation
System for".i got following error:

The colons (':') in your string are being treated as field markers. In
the Lucene Query Parser Syntax you can specify that you want to search
in a particular field with eg "author:(john smith)"

http://lucene.apache.org/java/3_3_0/queryparsersyntax.html

You have a few choices:

  1. preprocess your search string to not include bad syntax
  2. ignore the errors
  3. use the 'text' family of queries via the query DSL instead
    of the query string syntax

http://www.elasticsearch.org/guide/reference/query-dsl/text-query.html

clint


(system) #3