Open vipermn opened 4 years ago
Hi @viper2846 , can you send me the code of your query ? Do you have try with direct call to ES ?
@viper2846 Can you provide us an update for this issue ?
Hi Julien, Sorry for the slow reply. I was testing and trying things.
Anyway, I am using Elasticsearch 6.8 on AWS. I am using version 3.3.1.RELEASE of the spring-data-jest libraries.
Searching Elasticsearch using the opendistro sql tool through Postman shows that documents return when using an exact match (where propertySubType = 'Townhouse Quad/4 Corners'"). I have to use the keyword syntax to return documents using a like query (where propertySubType.keyword like '%4 Corners%'"). The conclusion is that Elasticsearch itself can return documents when searched containing a forward slash.
On the java side, saving and retrieving documents that contain a field with a forward slash is no issue.
Attempting to search with a propertySubtype parameter value containing a forward slash using the Spring repository throws the error you see in my original issue posting (findByPropertySubType(String propertySubType);) All other Spring repository searches that do not include the propertySubType parameter or do include a propertySubType parameter value without a forward slash return successfully. So a search for another document field (findByStandardStatus(String standardStatus);) or a search for propertySubType without a forward slash value (findByPropertySubType("Single Family Home");) work as expected.
What I discovered the other night is that replacing the forward slash with a space (propertySubType = propertySubType.replace("/", " ");) enables the search to successfully return the correct documents. So effectively searching for "Townhouse Quad 4 Corners" will correctly return documents containing a propertySubtype value of "Townhouse Quad/4 Corners".
Let me know if you need more information.
I have data stored in elasticsearch by this code that contains a / in the value. Storing the data works fine. However, when I go to retrieve the data, it throws an exception.
Data in Elasticsearch: Townhouse Quad/4 Corners
[main] ERROR com.github.vanroy.springdata.jest.mapper.DefaultErrorMapper - Cannot execute jest action , response code : 400 , error : {"root_cause":[{"type":"query_shard_exception","reason":"Failed to parse query [Townhouse Quad/4 Corners]","index_uuid":"xbMByFnjT66gxUm50vU1mQ","index":"sf"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"sf","node":"Q5vTBSn6SOGFfGr3agUTYw","reason":{"type":"query_shard_exception","reason":"Failed to parse query [Townhouse Quad/4 Corners]","index_uuid":"xbMByFnjT66gxUm50vU1mQ","index":"sf","caused_by":{"type":"parse_exception","reason":"Cannot parse 'Townhouse Quad/4 Corners': Lexical error at line 1, column 25. Encountered: after : \"/4 Corners\"","caused_by":{"type":"token_mgr_error","reason":"Lexical error at line 1, column 25. Encountered: after : \"/4 Corners\""}}}}]} , message : null
Any thoughts on how to fix? Like I said, using the library to store the value with the / works just fine.