Hi everybody !
I have two indexes with the following mapping :
"skills_metiers": {
"type": "nested",
"properties": {
"metier": {
"type": "keyword"
},
"experience": {
"type": "keyword"
}
}
}
I want to search skills_metiers from index 1 to index 2 :
def build_query(skills_metiers = None):
query = {
"size": 30,
"query": {
"bool": {
"should": [],
"must": []
}
}
}
if skills_metiers:
for metier in skills_metiers:
query["query"]["bool"]["should"].append({
"nested": {
"path": "skills_metiers",
"score_mode": "avg",
"query": {
"bool": {
"must": {
"query_string": {
"query": "skills_metiers.metier:" + metier['metier'] + " AND skills_metiers.experience:" + metier['experience']
}
}
}
}
}
})
return query
I search :
[{'experience': 'DEBUTANT', 'metier': 'CP'},
{'experience': 'DEBUTANT', 'metier': 'BI'},
{'experience': 'DEBUTANT', 'metier': 'BA'}]
and the results are :
6.7111297
[{'experience': 'DEBUTANT', 'metier': 'CP'},
{'experience': 'DEBUTANT', 'metier': 'BA'},
{'experience': 'DEBUTANT', 'metier': 'BI'}]
6.7111297
[{'experience': 'DEBUTANT', 'metier': 'CP'},
{'experience': 'DEBUTANT', 'metier': 'BA'},
{'experience': 'DEBUTANT', 'metier': 'BI'}]
4.9342995
[{'experience': 'DEBUTANT', 'metier': 'BA'},
{'experience': 'DEBUTANT', 'metier': 'BI'}]
3.7447155
[{'experience': 'DEBUTANT', 'metier': 'BA'},
{'experience': 'DEBUTANT', 'metier': 'CP'}]
1.9678854
[{'experience': 'DEBUTANT', 'metier': 'BA'}]
1.7768301
[{'experience': 'DEBUTANT', 'metier': 'CP'}]
1.7768301
[{'experience': 'DEBUTANT', 'metier': 'AMOA'},
{'experience': 'DEBUTANT', 'metier': 'CP'}]
I don't understand why neither results 3 and 4 are not equals nor results 5, 6 and 7...
Thanks