Java Rest API doesn't work as expected


(Vardan) #1

Hi there,

I'm using mapper plugin to index pdf files, and in Kibana console everything works as expected.
I've tried following request, and ElasticSearch responses with 2 documents:

POST /reports/generated/_search?filter_path=hits.hits._source
{
"query":{
"query_string":{
"query":"USD"
}
}
}

Both pdfs contain "USD" word.
But I do the same thing with Java REST API and ElasticSearch cannot make a search in the indexed pdfs.
For querying I'm using following java code:

String query = "{"query":{"query_string":{"query":"" + "USD" + ""}}}";
Response response = restClient.performRequest(
"POST",
"/reports/generated/_search?filter_path=hits.hits._source",
new Hashtable<>(),
new StringEntity(query));

When I change "USD" querying string with another value, which contains another field (not the attachment), then everything is working well. So do I need some configuration in my java restClient to enable context searching in the indexed pdfs?

Thanks,
Vardan


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.