I have a query like this the output expected is in order of fields specified.
name (String)
price (Double)
year (Integer)
but i am getting
price
year
name
so it is automatically getting sorted to put string last, is there anyway to enforce that i recieve result in same order as whatever is specified in fields
You mean sorting by it? When you specify fields, those are the fields that
will be returned as part of each hit, not sorting. There is a whole sorting
section that controls sorting.
I have a query like this the output expected is in order of fields
specified.
name (String)
price (Double)
year (Integer)
but i am getting
price
year
name
so it is automatically getting sorted to put string last, is there anyway
to
enforce that i recieve result in same order as whatever is specified in
fields
Thanks for the response, i am not talking about sorting, sorting decides
order of each record, here i am concerned about order of fields in each
record
say for example
Sorting will do something like this
record 1
Columns fName Lname age
Record 1 sam tom 20
Record 2 vim jones 25
sorted by Lname will return
Record 1 vim jones 25
Record 2 sam tom 20
for me this is will be worong
*
Columns age fName Lname *
I expect
*Columns fName Lname age *only, not worried by order of records but order
of columns
sorted by fname will return again records which are arranged
You mean sorting by it? When you specify fields, those are the fields that
will be returned as part of each hit, not sorting. There is a whole sorting
section that controls sorting.
I have a query like this the output expected is in order of fields
specified.
name (String)
price (Double)
year (Integer)
but i am getting
price
year
name
so it is automatically getting sorted to put string last, is there anyway
to
enforce that i recieve result in same order as whatever is specified in
fields
Thanks for the response, i am not talking about sorting, sorting
decides order of each record, here i am concerned about order of
fields in each record
JSON objects are by definition, an unordered collection of key:value
pairs. Even if ES were to return the "fields" object in a particular
order, as soon as you parse JSON the order may be changed.
Thanks for you response, we are using Elasticsearch as a intermediate
data, we are doing very complex compiling and de compiling of data , and
our front end expects order of fields to be maintained, so i wanted as much
functionality i can get directly, anyways we ended up writing a json parser
which will maintain field order.
Thanks for the response, i am not talking about sorting, sorting
decides order of each record, here i am concerned about order of
fields in each record
JSON objects are by definition, an unordered collection of key:value
pairs. Even if ES were to return the "fields" object in a particular
order, as soon as you parse JSON the order may be changed.
clint
If you reply to this email, your message will be added to the discussion
below:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.