D
D
DimaSeleznev2012-12-17 07:51:06
Programming
DimaSeleznev, 2012-12-17 07:51:06

CouchDB, Elasticsearch - Problem creating index

Hey Habr! Help with Elasticsearch.

I am using CouchDB, Elasticsearch and the elasticsearch-river-couchdb plugin to communicate between them. There are objects in the database with a name

field of type object :

{
  "name": {
     "first": "Ivan",
     "last": "Ivanov"
  }
}


There are also objects where the name field is of type string:

{
  "name":"Ivan Ivanov"
}


Problem: The index is only created for objects where the name field is of type object .
The mapping for the name field specifies the object type.

Question: is it possible to somehow specify type 2 for a field?

If not, then perhaps you should create 2 indexes for 1 database, and in each index take into account objects with the desired field type?

I tried to turn such a thing, but the idea was not crowned with success. Created 2 indexes and set the following settings for them.

For the first:

-XPUT 'site.ru:9200/_river/dev_idx/_meta' -d '{
     "type" : "couchdb",
     "couchdb" : {
  "host" : "127.0.0.1",
         "port" : 5984,
         "user" : "User",
         "password" : "Test",
         "db" : "dev",
         "filter" : null
         }
     },
     "index" : {
         "index" : "dev",
         "type" : "dev",
         "bulk_size" : "100",
         "bulk_timeout" : "10ms"
     }
 }'


For the second:

-XPUT 'site.ru:9200/_river/dev_third/_meta' -d '{
     "type" : "couchdb",
     "couchdb" : {
  "host" : "127.0.0.1",
         "port" : 5984,
         "user" : "User",
         "password" : "Test",
         "db" : "dev",
         "filter" : null,
         
         "ignore_attachments":true
         }
     },
     "index" : {
         "index" : "dev_third",
         "type" : "dev_third",
         "bulk_size" : "100",
         "bulk_timeout" : "10ms"
     }
 }'


As a result: the first index works, the second does not.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question