I have an ElasticSearch setting that receives data for indexing across the CouchDB River. I have a problem with the fact that most of the fields in CouchDB documents are actually not related to search: they are internal fields of the application (identifiers, etc.), and I do not want to receive false positives because of these fields. In addition, indexing unnecessary data seems like a waste of resources to me.
To solve this problem, I defined a mapping in which I specify the fields that I want to index. I am using pyes to access ElasticSearch. The process I'm following is as follows:
- Create the CouchDB River associated with the index. This, apparently, also creates an index and creates a “couchdb” mapping in this index, which, as far as I see, includes all fields with dynamically assigned types.
- Put the mapping by rearranging it in the fields that I really want to index.
This is the index definition obtained by:
curl -XGET http:
{
"notes_index" : {
"default_mapping" : {
"properties" : {
"note_text" : {
"type" : "string"
}
}
},
"couchdb" : {
"properties" : {
"_rev" : {
"type" : "string"
},
"created_at_date" : {
"format" : "dateOptionalTime",
"type" : "date"
},
"note_text" : {
"type" : "string"
},
"organization_id" : {
"type" : "long"
},
"user_id" : {
"type" : "long"
},
"created_at_time" : {
"type" : "long"
}
}
}
}
}
The problem I have is multi-valued:
- that the default display is "couchdb" indexing all fields. I do not want this. Can this mapping be avoided? I am confused because this mapping seems to be something that somehow “connects” to the CouchDB river.
- the mapping I created seems to have no effect: there are no documents indexed by this mapping
Do you have any tips on this?
EDIT
, , , :
server="localhost"
curl -XPUT "$server:9200/index1"
curl -XPUT "$server:9200/index1/mapping1/_mapping" -d '
{
"type1" : {
"properties" : {
"note_text" : {"type" : "string", "store" : "no"}
}
}
}
'
curl -XPUT "$server:9200/_river/river1/_meta" -d '{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"user" : "admin",
"password" : "admin",
"db" : "notes"
},
"index" : {
"index" : "index1",
"type" : "type1"
}
}'
index1 - , "note_text", , . ?