2

I have a JSON field that is an array of elements composed of oid, instance and value. Most of my queries will be on a combination of oid and instance.

What is the syntax for creating such an index if the combination of oid and instance is unique?

[
 { 'oid' : '1.3.1', 'instance' : '0', 'value' : '0' }, 
 { 'oid' : '1.3.1', 'instance' : '2', 'value' : '9' },
 { 'oid' : '1.3.6.1', 'instance' : '0', 'value' : '1' },
 { 'oid' : '1.3.6.9', 'instance' : '0', 'value' : '1' }
]

Thanks, Avi

2
  • 1
    Related: stackoverflow.com/questions/12406269/… the answer there is to index whole JSON text. Commented Oct 23, 2013 at 14:34
  • Please provide version of the server. Commented Oct 23, 2013 at 14:43

1 Answer 1

1

Create full-text index and search for substring. Another option would be to use intermediate indexed table that keeps parsed values and points to the one with JSON.

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

Comments

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.