1

I'm using Elassandra to make search in mail, Cassandra to save the mail and ElasticSearch to search in those mails.

My problem is that since ElasticSearch 6, we can't use multiple type in one mapping. Here is my mapping:

"mappings": {
    "mail__mail": {
        "discover" : ".*",
        "properties": {
            "mailfrom": { 
                "type": "text",
                "fields": {
                    "keyword": {
                        "type": "keyword"
                    },
                    "ngram": {
                        "type": "text",
                        "analyzer": "edge_ngram_analyzer",
                        "search_analyzer": "edge_ngram_search_analyzer"
                    }
                }
            },
            "subject": { 
                "type": "text",
                "fields": {
                    "keyword": {
                        "type": "keyword"
                    },
                    "ngram": {
                        "type": "text",
                        "analyzer": "edge_ngram_analyzer",
                        "search_analyzer": "edge_ngram_search_analyzer"
                    }
                }
            },
            "date" : {
                "type" : "date"
            },
            "folderid" : {
                "type" : "text"
            }
        }
    },
    "mail__account" : {
        "discover" : ".*",
        "properties": {
            "userId" : {
                "type" : "Integer"
            }
        }
    }
}

How can i use ElasticSearch 6 to search in multiple cassandra table ?

2 Answers2

1

Since ES6 you need to map 1 table per index. Searching multiple indexes:

https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.html

Alex Tbk
  • 2,042
  • 2
  • 20
  • 38
  • Yes but with Elassandra, i can only create one index per keyspace. I don't understand the relation on my problem and your link. – Hugo Pierrat Sep 18 '18 at 16:48
  • [Here's the link](https://github.com/strapdata/elassandra/issues/156) from a related issue in the Elassandra repo – RyanQuey Jun 24 '20 at 05:44
1

As @Alex said, you need to map 1 table per ES index, but you can create multiple ES indexes per keyspace, mapping to different tables.

You have to specify a keyspace name as an index setting. This is done with the following syntax :

curl -XPUT "http://localhost:9200/your_index/" -d '{
    "settings" : { "keyspace" : "your_keyspace" },
    "mappings" : {
        "your_table" : {
            "properties" : {
                ...
            }
        }
    }
}
barth
  • 431
  • 2
  • 5