# Which of these will be fastest way of querying my data

**URL:** <https://discuss.elastic.co/t/which-of-these-will-be-fastest-way-of-querying-my-data/8910>\
**Category:** Elasticsearch\
**Created:** [August 31, 2012, 8:02pm UTC](https://discuss.elastic.co/t/which-of-these-will-be-fastest-way-of-querying-my-data/8910 "2012-08-31T20:02:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pradeep\_2](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@Pradeep\_2](https://discuss.elastic.co/u/Pradeep_2)\
**Post date:** [August 31, 2012, 8:02pm UTC](https://discuss.elastic.co/t/which-of-these-will-be-fastest-way-of-querying-my-data/8910/1 "2012-08-31T20:02:07Z")

</div>

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

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:14am UTC](https://discuss.elastic.co/t/which-of-these-will-be-fastest-way-of-querying-my-data/8910/2 "2017-07-06T03:14:21Z")

</div>


