-
-
Save brsanthu/1872375 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XGET 'http://localhost:9200/test/_search?pretty=true' -d '{ | |
"query":{ | |
"bool":{ | |
"should": [ | |
{ | |
"constant_score":{ | |
"filter" : { | |
"query":{ | |
"query_string":{ | |
"query":"findme", | |
"fields":["keywords"], | |
"use_dis_max":true | |
} | |
} | |
}, | |
"boost": 1000000 | |
} | |
}, | |
{ | |
"filtered": { | |
"query": { | |
"query_string":{ | |
"query":"findme", | |
"fields":["title","body","keywords"], | |
"use_dis_max":true | |
} | |
}, | |
"filter": { | |
"not": { | |
"type": { | |
"value": "boosted" | |
} | |
} | |
} | |
} | |
} | |
] | |
} | |
} | |
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XGET 'http://localhost:9200/test/_search?pretty=true' -d '{ | |
"query":{ | |
"bool":{ | |
"should": [ | |
{ | |
"constant_score":{ | |
"filter" : { | |
"query":{ | |
"query_string":{ | |
"query":"findme", | |
"fields":["keywords"], | |
"use_dis_max":true | |
} | |
} | |
}, | |
"boost": 1000000 | |
} | |
} | |
] | |
} | |
} | |
}' | |
curl -XGET 'http://localhost:9200/test/_search?pretty=true' -d '{ | |
"query":{ | |
"bool":{ | |
"should": [ | |
{ | |
"filtered": { | |
"query": { | |
"query_string":{ | |
"query":"findme", | |
"fields":["title","body","keywords"], | |
"use_dis_max":true | |
} | |
}, | |
"filter": { | |
"not": { | |
"type": { | |
"value": "boosted" | |
} | |
} | |
} | |
} | |
} | |
] | |
} | |
} | |
}' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPUT 'http://localhost:9200/test/regular/1' -d '{ | |
"title" : "Regular Doc1", | |
"body" : "findme" | |
}' | |
curl -XPUT 'http://localhost:9200/test/regular/2' -d '{ | |
"title" : "Regular Doc2", | |
"body" : "findme" | |
}' | |
curl -XPUT 'http://localhost:9200/test/boosted/3' -d '{ | |
"title" : "Boosted Doc1", | |
"body" : "dont find me", | |
"keywords" : ["findme","findme2"] | |
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XGET 'http://localhost:9200/test/_search?pretty=true' -d '{ | |
"query":{ | |
"bool":{ | |
"should": [ | |
{ | |
"constant_score":{ | |
"query":{ | |
"query_string":{ | |
"query":"findme", | |
"fields":["keywords"], | |
"use_dis_max":true | |
} | |
}, | |
"boost": 1000000 | |
} | |
}, | |
{ | |
"filtered": { | |
"query": { | |
"query_string":{ | |
"query":"findme", | |
"fields":["title","body","keywords"], | |
"use_dis_max":true | |
} | |
}, | |
"filter": { | |
"not": { | |
"type": { | |
"value": "boosted" | |
} | |
} | |
} | |
} | |
} | |
] | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment