0

I have json data as follows

{
  "_index": "project",
  "_type": "ts_order_snapshot",
  "_id": "1",
  "_version": 1,
  "exists": true,
  "_source": {
    "order_id": "100000001",
    "order_data": "Order Data:{\"entity_id\":\"1\",\"state\":\"canceled\"}"
  }
}

Now I would like to get the list of all the order ids having state as canceled. Any suggestions?

0

1 Answer 1

1

order_data is a serialized, json-encoded string, not a structured json map. If you promoted it to actual json, you could construct a query like ?q=order_data.state:canceled&fields=order_id.

Sign up to request clarification or add additional context in comments.

3 Comments

I am very new to JSON also. Could you please elaborate on this. How to transform this serialized JSON encoded string to actual JSON.
is this a fine encoding? {"_index":"project","_type":"ts_order_snapshot","_id":"1","_version":55,"exists":true, "_source" : {"order_id":"100000001","order_data":{"entity_id":"1","state":"canceled"}}} And could you suggest me a query to get the results.
Yes, that's what you want. See the query example in my first response.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.