Hi,
I have a search string that is already JSON string like this:
{
description:"Cisco Network Data Switch"
}
When I pass it to the code below :
SearchRequestBuilder srb =
client.prepareSearch("asset_index").setTypes("Asset").setSearchType(
SearchType.DEFAULT).setQuery(search);
SearchResponse response = srb.execute().actionGet();
... I get :
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [query], total failure; shardFailures
{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][0]:
SearchParseException[[asset_index][0]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][4]:
SearchParseException[[asset_index][4]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][1]:
SearchParseException[[asset_index][1]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][3]:
SearchParseException[[asset_index][3]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }
{
"match_phrase": {
description:"Cisco Network Data Switch"
}
}
But it will not be very flexible solution in the long run. I would advise
parsing this json in your application and building an appropriate query out
of it.
On Wednesday, January 16, 2013 12:06:59 AM UTC-5, JD wrote:
Hi,
I have a search string that is already JSON string like this:
{
description:"Cisco Network Data Switch"
}
When I pass it to the code below :
SearchRequestBuilder srb =
client.prepareSearch("asset_index").setTypes("Asset").setSearchType(
SearchType.DEFAULT).setQuery(search);
SearchResponse response = srb.execute().actionGet();
... I get :
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [query], total failure; shardFailures
{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][0]:
SearchParseException[[asset_index][0]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][4]:
SearchParseException[[asset_index][4]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][1]:
SearchParseException[[asset_index][1]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][3]:
SearchParseException[[asset_index][3]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }
On Wednesday, January 16, 2013 12:06:59 AM UTC-5, JD wrote:
Hi,
I have a search string that is already JSON string like this:
{
description:"Cisco Network Data Switch"
}
When I pass it to the code below :
SearchRequestBuilder srb =
client.prepareSearch("asset_index").setTypes("Asset").setSearchType(
SearchType.DEFAULT).setQuery(search);
SearchResponse response = srb.execute().actionGet();
... I get :
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [query], total failure; shardFailures
{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][0]:
SearchParseException[[asset_index][0]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][4]:
SearchParseException[[asset_index][4]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][1]:
SearchParseException[[asset_index][1]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][3]:
SearchParseException[[asset_index][3]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }
Yep. I agree it was not a query. Where can I find what are possible values
in Query DSL - like the one you mentioned “match_phrase”.
While we are at it I have another question - In production probably it is
better to get from user a search string and pass it as is (like “(Cisco AND
Network) OR Firewall”) to the code like this:
… and let the elasticsearch to do the job for you? Would you agree?
Regards,
Janusz
On Wednesday, 16 January 2013 16:06:59 UTC+11, JD wrote:
Hi,
I have a search string that is already JSON string like this:
{
description:"Cisco Network Data Switch"
}
When I pass it to the code below :
SearchRequestBuilder srb =
client.prepareSearch("asset_index").setTypes("Asset").setSearchType(
SearchType.DEFAULT).setQuery(search);
SearchResponse response = srb.execute().actionGet();
... I get :
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [query], total failure; shardFailures
{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][0]:
SearchParseException[[asset_index][0]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][4]:
SearchParseException[[asset_index][4]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][1]:
SearchParseException[[asset_index][1]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][3]:
SearchParseException[[asset_index][3]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }
Using queryString query sounds like a good idea. I would say what you are
describing is the primary use case for that query.
On Wednesday, January 16, 2013 6:25:38 PM UTC-5, JD wrote:
Hi,
Thanks for both replies.
Yep. I agree it was not a query. Where can I find what are possible values
in Query DSL - like the one you mentioned “match_phrase”.
While we are at it I have another question - In production probably it is
better to get from user a search string and pass it as is (like “(Cisco AND
Network) OR Firewall”) to the code like this:
… and let the elasticsearch to do the job for you? Would you agree?
Regards,
Janusz
On Wednesday, 16 January 2013 16:06:59 UTC+11, JD wrote:
Hi,
I have a search string that is already JSON string like this:
{
description:"Cisco Network Data Switch"
}
When I pass it to the code below :
SearchRequestBuilder srb =
client.prepareSearch("asset_index").setTypes("Asset").setSearchType(
SearchType.DEFAULT).setQuery(search);
SearchResponse response = srb.execute().actionGet();
... I get :
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [query], total failure; shardFailures
{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][0]:
SearchParseException[[asset_index][0]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][4]:
SearchParseException[[asset_index][4]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][1]:
SearchParseException[[asset_index][1]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }{[PdwFM8JUTjqVbZqPEdOT0w][asset_index][3]:
SearchParseException[[asset_index][3]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"query_binary":"ewoJZGVzY3JpcHRpb246IkNpc2NvIE5ldHdvcmsgRGF0YSBTd2l0Y2giCn0="}]]];
nested: QueryParsingException[[asset_index] [_na] query malformed, no field
after start_object]; }
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.