elasticsearch wildcard string search query with '>' -


i have string field mapped 'not_analyzed'. each string has '>' simbol , need find string it.

string e.g)

one>two>tree>four>...

with below query, result expected.

"query": { "wildcard": { "activityseq": { "value": "one*" } } }

but when added '>' in value, it's not.

"query": { "wildcard": { "activityseq": { "value": "one>*" } } }

or

"query": { "wildcard": { "activityseq": { "value": "one>*" } } }

any idea of this?


document sample

{ "_index": "pm", "_type": "dmcase_00090", "_id": "avq7wjht0bpb6l5mykw7", "_version": 1, "_score": 1, "_source": { "endat": "1970-01-12t06:08:00+09:00", "startat": "1970-01-06t23:02:00+09:00", "activityseq": "maketicket>firstcontact>arrangesurvey>maketicket>informclientsurvey>arrangesurvey>survey>survey>internrepair>repairready>internrepair>sendtickettofinadmin>ticketready>readyinformclient", "events": [ { ... events


query + result

1.

"query": { "wildcard": { "activityseq": { "value": "maketicket*" } } }

result : data expect

2.

"query": { "wildcard": { "activityseq": { "value": "maketicket>*" } } }

result

"hits": { "total": 0, "max_score": null, "hits": [] }

3.

"query": { "wildcard": { "activityseq.raw": { "value": "maketicket*" } } }

result

"hits": { "total": 0, "max_score": null, "hits": [] }

4.

"query": { "wildcard": { "activityseq": { "value": "maketicket>*" } } }

result

"caused_by": { "type": "json_parse_exception", "reason": "unrecognized character escape '>' (code 62)\n @ [source: [b@61201912; line: 5, column: 37]" }

your query needs , work, i.e. need match on seqstring.raw sub-field, since that's 1 not_analyzed

{   "query": {     "wildcard": {       "seqstring.raw": {         "value": "one>*"       }     }   } } 

Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -