Skip to content

Instantly share code, notes, and snippets.

View umeshdangat's full-sized avatar

Umesh Dangat umeshdangat

View GitHub Profile
package com.sample.elasticsearch.plugins.sample;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.index.fielddata.ScriptDocValues;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.plugins.ScriptPlugin;
import org.elasticsearch.script.AbstractDoubleSearchScript;
import org.elasticsearch.script.ExecutableScript;
import org.elasticsearch.script.NativeScriptFactory;
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 2,
curl -XGET 'localhost:9200/testindex/_search?pretty' -d'
{
"query": {
"function_score": {
"script_score": {
"script": {
"lang": "painless",
"inline": "String foo = doc[\u0027qa_data\u0027].get(0).toString(); return 200;"
}
}
@umeshdangat
umeshdangat / index_binary_doc_values.sh
Last active November 12, 2016 22:45
Index docs with binary field type
curl -s -XPUT "http://localhost:9200/testindex/" -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"test":{"_all":{"enabled":false},
"properties":{
"qa_data":{"type":"binary", "doc_values": true}
}