Now that I am not at work, I had a chance t finally read your posts more
carefully. I guess what you are looking for is a way to dynamically change
the sort based on the result set? That is a tough challenge. Query rescorer
will not work since it only works on the top k, aka after the documents are
already sorted.

One hack I can think of is if you provide a custom sort value for the
missing values [1] and you can look for this value in the query rescorer.
If present, then apply some other scoring, if not leave it be. You cannot
know the values of the other documents in the top k result set.

Top bad you can't apply facets to the top n results (I don't think
aggregations support this feature either), because you could of aggregated
the location field and detect how many documents are missing the field
based on the aggregation values.

[1]
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#_missing_values

Cheers,

Ivan


On Tue, Jul 8, 2014 at 11:04 AM, coder <mukulnit...@gmail.com> wrote:

> yes, I got it. You are right Ivan. I think I should omit the field
> altogether because that way it won't find that field and will not try to
> index it. I think that should work. I'll try it and will let you know if
> that works.
>
> But how can I make the use of that location field is also very important.
> Can you give some of your precious time to answer the second part of the
> question. It will be a great help for me.
>
> Thanks
>
>
> On Tuesday, 8 July 2014 23:29:49 UTC+5:30, Ivan Brusic wrote:
>
>> I made a very important mistake in my first response. What I meant to say
>> is
>>
>> Can you simply index the document WITHOUT the field entirely?
>>
>> What it appears that you are doing is indexing a field with no value. One
>> solution would be to simply omit the field altogether. Elasticsearch/Lucene
>> is scheme-less, so you can index a document without a field compared to the
>> other documents. The mapper is only used on fields that exist. If this is
>> not the case, can you provide a sample document?
>>
>> --
>> Ivan
>>
>>
>> On Tue, Jul 8, 2014 at 10:52 AM, coder <mukul...@gmail.com> wrote:
>>
>>> Yes, I can index the documents which contain location field but not
>>> those documents which don't contain location field. It gives a parsing
>>> exception in that case and then stops importing documents. Is there anyway
>>> by which I can tell the ES that index location if it's present otherwise
>>> skip it ?
>>>
>>> Actually I have a mix of documents (some contains location and some are
>>> without location), now let's say,result of a user query is a document which
>>> don't contain location field, Now if I do a sorting this will put that
>>> document in the last/first position. In this case, it will work but not in
>>> other cases where actual result needs to be a location based document. So,
>>> sorting won't fix my issue. I don't know always whether to put location
>>> missing document on top/bottom position.
>>>
>>> For query Rescorer, I'm not able to understand how can I apply it to the
>>> top k results from the first query. How to rescore based on location ?
>>> On quick Googling I found this:
>>>
>>> "query": {
>>>   "function_score": {
>>>     "functions": [
>>>       { "gauss":  { "loc":   { "origin": "51,0", "scale": "5km" }}},
>>>     ]
>>>   }
>>> }
>>>
>>> But, this is something similar to sorting, right ? Also, there might be
>>> a case in which you gave some score based on location field to a document.
>>> Now another document exist without location field so in this case your
>>> default score will be 0 and chances are that the actual match was this
>>> document(without location) which should come on the top but due to
>>> rescoring its score has reduced and it will not appear on top. How to
>>> tackle this kind of problem ?
>>>
>>> What I need something like this: I should first query ES, then inspect
>>> the results and decide if I really need location based biasing based on the
>>> results. If results of a query is a document which don't contain location
>>> field, the I know location based biasing will badly affect results. So, I
>>> won't go for location based biasing but let's say I got a result which
>>> contains a location field, so I'll go for a location based biasing.
>>> Something like conditional biasing. Is there any way by which I can use the
>>> result of response again for manipulation because querying again will take
>>> a lot of time ?
>>>
>>> Accept my apology if I'm not making things a bit clearer. Please don't
>>> hesitate to ask further questions for clarity.
>>> Thanks
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Tuesday, 8 July 2014 21:51:29 UTC+5:30, Ivan Brusic wrote:
>>>
>>>> In terms of the parsing exception, can you simply index the document
>>>> with the field entirely?
>>>>
>>>> As far as sorting goes, it makes sense to push the location-less
>>>> documents to the top or bottom. You lost me on the part regarding the
>>>> rescorer. Do you need the location-less documents to be returned in your
>>>> query?
>>>>
>>>> --
>>>> Ivan
>>>>
>>>>
>>>> On Tue, Jul 8, 2014 at 9:16 AM, coder <mukul...@gmail.com> wrote:
>>>>
>>>>> HI,
>>>>>
>>>>> I need to index a mix of documents, some of which needs to be indexed
>>>>> using geo_point with a location fields but there are some other documents
>>>>> which don't contain location field. Whenever I do indexing, I keep getting
>>>>> Mapper parsing exception with location={} during indexing and 
>>>>> elasticsearch
>>>>> stops importing documents. Can anyone give me any idea how to work around
>>>>> the problem ?
>>>>>
>>>>> Also, My requirement needs me to give search results based on location
>>>>> based biasing. I have read http://www.elasticsearch.
>>>>> org/blog/geo-location-and-search/ but not able to fit it in my
>>>>> usecase. Since I have a mix of documents, I can't simply sort on the basis
>>>>> of geo distance since it will put documents without location field either
>>>>> at top or at bottom while sorting. Can anyone tell me how can I apply
>>>>> sorting only on top k results. I have read about Query rescorer but I 
>>>>> can't
>>>>> use it. I need to apply location based sorting only when a certain
>>>>> documents are returned. Based on that I need to make a decision whether to
>>>>> apply sorting or not. If I'll use rescorer it will rescore documents
>>>>> everytime. Is there anyway by which I can incorporate weight of location
>>>>> based score in normal score. Default can 0 and if some score x comes, use
>>>>> F(x). My problem is getting a proper formula for the case and how to use 
>>>>> it
>>>>> in a query ?
>>>>>
>>>>> Looking forward for your help !!!
>>>>>
>>>>> Thanks,
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "elasticsearch" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to elasticsearch+unsubscr...@googlegroups.com.
>>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>>> msgid/elasticsearch/d38363da-f291-4b20-a403-a0fc5e729e18%40goo
>>>>> glegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "elasticsearch" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to elasticsearc...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/elasticsearch/68e2bb95-453c-476c-a8ec-8487aca2fba5%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/elasticsearch/68e2bb95-453c-476c-a8ec-8487aca2fba5%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elasticsearch+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/919e7d5d-bf21-477e-ae83-1504eeed7368%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/919e7d5d-bf21-477e-ae83-1504eeed7368%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCAZYO04UhGGT5Q9udKi0e1ipp46gRgcdV31W%3DBnwp4cw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to