Which of these will be fastest way of querying my data


(Pradeep-2) #1

I have a use-case where I have to query elastic with multiple (huge number
of) values of a field.

e.g. if I have this as an attribute "uid" in the doc

"query" {
"uid" : [1, 2, 3, 4, 6, 7,... (upto 300k such values) ]
}

OR

I can have this field as ID of the document itself.. ( I guess _id is
treated as a string? ) and query
"ids" : {
"values" : [1, 4, 100 ....... (upto 300k such values) ]
}

which will be faster??

To put it down concisely.. am trying to find performance difference in such
use case.. if the filed I am querying is

  1. _id -- long
  2. _id -- Integer
  3. _id -- string
  4. long field
  5. Integer field
  6. String filed

(*** I dont know if you can have long/ int for _id)

My values are not numeric values.. but are 8 char unique strings. I can
hash them to a long if its faster..
I can use that as doc _id if its faster!

please help

--


(system) #2