0
votes

I have string field that mapped as 'not_analyzed'. Each string has '>' simbol and need to find some string with it.

string e.g)

one>two>tree>four>...

with below query, I could get result I 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": [ { ... some events


query + result

1.

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

result : data as I 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 at [Source: [B@61201912; line: 5, column: 37]" }

1
I've tried on my end and all of the above queries do return the document as expected. Can you update your question with the output your get from curl -XGET localhost:9200/your_index (rename your_index to match your actual index name) ?Val
"myTable": { "properties": { "seqstring": { "type": "string", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, It's part of my metadata.J.Done

1 Answers

1
votes

Your query needs to look like this and it will work, i.e. you need to match on the seqstring.raw sub-field, since that's the one which is not_analyzed

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