Hello All,
I am new to elasticsearch and recently started using ES 6.x which is integrated with one of the third party application which stores all the data using indexes in ES. I have a scenario where I would like to read documents from ES using query, and for this, I have started exploring ES search query to read the documents containing specific key=value pairs, I have started with exact match search query i.e.
{"query":{"bool":{"must":[{"match_phrase":{"input":{"query":"key=values"}}}],"filter":[{"range":{"startTime":{"gte":"now-10d","lt":"now"}}}]}}}
This above query returns me correct documents which matches with "key=value" and field 'input' is of type 'text' which is controlled by the third party app and sample format of how "input" field looks like in ES output is:
"input":"{key1=76f435fe-ac81-49aa-8050-8c647922e51d, key2={key3=1234, key4=AB}}"
Now, I would like to write generic query which matches a specific regex pattern for values and give me all the documents and i have tried this below query but doesn't work i.e. does not return any results
{"query":{"regexp":{"input":"key4=[A-Z]{2}"}}}
could anyone please advise where i am going wrong with regexp query?
Thanks, Ketan