I'm using Elastic Search to index user documents. We're looking to
implement a custom score based on the closeness of other users. So we'll
compare one user to another. Each user has the following fields:
interests: ["Lucene", "ElasticSearch"...]
Python Script
len(set(interests).intersection(set(doc['interests'].value)))
The script is attempting to find the common interests between the two
people, however it keeps giving an error. I'm using the Ruby Tire gem,
which produces the following command:
[REQUEST FAILED] curl -X GET
"http://localhost:9200/users/user/_search?pretty=true" -d
'{"query":{"custom_score":{"params":{"interests":["Entrepreneurship","Travel","Technology","Startups"]},"script":"meeteor","lang":"python","query":{"bool":{"should":[{"query_string":{"query":"jobs.employer:Facebook","default_operator":"AND"}},{"query_string":{"query":"jobs.employer:AOL","default_operator":"AND"}},{"query_string":{"query":"experienced_industries:Computer
Software","default_operator":"AND"}},{"query_string":{"query":"experienced_industries:Internet","default_operator":"AND"}}]}}}},"filter":{"and":[{"term":{"is_active":1}},{"term":{"is_email_confirmed":1}}]}}'
Tire::Search::SearchRequestFailed: 500 :
{"error":"SearchPhaseExecutionException[Failed to execute phase [query],
total failure; shardFailures {[7WFRorBIQoiuD2kl_RXGfQ][users][1]:
QueryPhaseExecutionException[[users][1]: query[filtered(custom score
(jobs.employer:facebook jobs.employer:aol (+experienced_industries:computer
+_all:software) experienced_industries:internet,function=script[meeteor],
params [{interests=[Entrepreneurship, Travel, Technology,
Startups]}]))->cache(_type:user)],from[0],size[10]: Query Failed [Failed to
execute main query]]; nested: }{[7WFRorBIQoiuD2kl_RXGfQ][users][2]:
QueryPhaseExecutionException[[users][2]: query[filtered(custom score
(jobs.employer:facebook jobs.employer:aol (+experienced_industries:computer
+_all:software) experienced_industries:internet,function=script[meeteor],
params [{interests=[Entrepreneurship, Travel, Technology,
Startups]}]))->cache(_type:user)],from[0],size[10]: Query Failed [Failed to
execute main query]]; nested: }]","status":500}
Any idea what's wrong?