The order of the result doesn't work properly?


(Kun Niu) #1

Hi all,
I don't know if anyone has the same problem with me.
I do a search using transport client and called addSort like this:
addSort("FILE_OFFSET", SortOrder.DESC)
I have three records in elasticsearch server with "FILE_OFFSET" - 340,
760, 1100.
It seems that each time I search the result, I can only find the
result with 760 as FILE_OFFSET.
Can anyone here help me with this issue?

Thanks and best regards,
Kun


(Kun Niu) #2

Hi all,
I found that the search order is based on string.
But I want to set the search order based on long value.
Can anyone here tell me how to set the search order based on long
value instead of string value?
I'm using Java API.

Thanks and best regards,
Kun

On Aug 5, 5:00 pm, Rent a room haoniu...@gmail.com wrote:

Hi all,
I don't know if anyone has the same problem with me.
I do a search using transport client and called addSort like this:
addSort("FILE_OFFSET", SortOrder.DESC)
I have three records in elasticsearch server with "FILE_OFFSET" - 340,
760, 1100.
It seems that each time I search the result, I can only find the
result with 760 as FILE_OFFSET.
Can anyone here help me with this issue?

Thanks and best regards,
Kun


(Igor Motov) #3

You can do it by specifying "long" type for the FILE_OFFSET field in
your index mapping. See http://www.elasticsearch.org/guide/reference/mapping/core-types.html
for more information.

On Aug 7, 2:33 am, kun niu haoniu...@gmail.com wrote:

Hi all,
I found that the search order is based on string.
But I want to set the search order based on long value.
Can anyone here tell me how to set the search order based on long
value instead of string value?
I'm using Java API.

Thanks and best regards,
Kun

On Aug 5, 5:00 pm, Rent a room haoniu...@gmail.com wrote:

Hi all,
I don't know if anyone has the same problem with me.
I do a search using transport client and called addSort like this:
addSort("FILE_OFFSET", SortOrder.DESC)
I have three records in elasticsearch server with "FILE_OFFSET" - 340,
760, 1100.
It seems that each time I search the result, I can only find the
result with 760 as FILE_OFFSET.
Can anyone here help me with this issue?

Thanks and best regards,
Kun


(Kun Niu) #4

Right. I got it.
Thanks a lot.

-----Original Message-----
From: elasticsearch@googlegroups.com
[mailto:elasticsearch@googlegroups.com] On Behalf Of imotov
Sent: 2011年8月8日 4:11
To: elasticsearch
Subject: Re: The order of the result doesn't work properly?

You can do it by specifying "long" type for the FILE_OFFSET field in your index
mapping. See
http://www.elasticsearch.org/guide/reference/mapping/core-types.html
for more information.

On Aug 7, 2:33 am, kun niu haoniu...@gmail.com wrote:

Hi all,
I found that the search order is based on string.
But I want to set the search order based on long value.
Can anyone here tell me how to set the search order based on long
value instead of string value?
I'm using Java API.

Thanks and best regards,
Kun

On Aug 5, 5:00 pm, Rent a room haoniu...@gmail.com wrote:

Hi all,
I don't know if anyone has the same problem with me.
I do a search using transport client and called addSort like this:
addSort("FILE_OFFSET", SortOrder.DESC) I have three records in
elasticsearch server with "FILE_OFFSET" - 340, 760, 1100.
It seems that each time I search the result, I can only find the
result with 760 as FILE_OFFSET.
Can anyone here help me with this issue?

Thanks and best regards,
Kun


(system) #5