Hi Folks
I have created test data like this in Sense.
PUT /myccindexallanalyzed/testobject/_bulk
{"index":{"_id":1}}
{"name":"do not","description":"single test word"}
{"index":{"_id":2}}
{"name":"single test word","description":"do not"}
I am trying to search for "sin* test" and want the document which has this
phrase in Name field to be first.
I do get the document but the one in the description field has higher
score. What am I doing wrong here?
Here is the query :
GET myccindexallanalyzed/testobject/_search?explain
{
"query": {
"bool": {
"should" : [
{
"span_near":
{"clauses":
[
{"span_multi":{"match":{"wildcard":{"description":{"wildcard":"sin*","boost":1.0}}}}}
,{"span_multi":{"match":{"wildcard":{"description":{"wildcard":"test","boost":1.0}}}}}
]
,"slop":0 ,"in_order":true,"collect_payloads":false
}
},
{
"span_near":
{"clauses":
[
{"span_multi":{"match":{"wildcard":{"name":{"wildcard":"sin*","boost":2.0}}}}}
,{"span_multi":{"match":{"wildcard":{"name":{"wildcard":"test","boost":2.0}}}}}
]
,"slop":0 ,"in_order":true,"collect_payloads":false
}
}
]
,"minimum_should_match" : 1
}
}
}
On Tuesday, September 9, 2014 10:50:21 AM UTC-7, Amish Asthana wrote:
>
> Hi Folks
> We have a bunch of fields for a document.
> Lets call them "field1",'field2"....., "FIELD1","FIELD2"......
>
> When we search for a particular text we want to see those records first
> which has that text in "FIELD1"..."FIELDn" before records from "field1",
> "field2" etc.
>
> Now the complications :
> a) We have lots of field. Doing internal testing we found that if we copy
> the fields to a common field(using "copy_to" something akin to _all field)
> and do search only that field then the search is much faster then doing a
> multi match query on list of fields. Not found any document on this, but
> this seem to be the case in all our internal testing.
> b) We have our own analyzer for different copy to field. So lets say I
> have "my_own_analyzed_all_field1" on which I am searching. All values from
> "field1"..... "FIELDn" is copied here.
> c) The "boost" parameter for field as far I see work for field type( As
> far as I see its only deprecated for document ). However this only works if
> the result is going to "_all' field. It does not seem to be boosting the
> field getting copied to "my_own_analyzed_all_field1".
>
> So the question is can it be done here? Or do we have to do multi match
> query with each field boosted by certain factor.
>
>
>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/8eac1aa8-8b06-44c3-b4d0-20965160e771%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.