1

I have table on Elassandra. I need to create elastic search index on only few columns of that table not on entire table.

{"discover":".*"} option is creating index on all columns of the table. But i am unable create index on few columns.

curl -XPUT -H 'Content-Type: application/json' 'http://localhost:9200/test_idx' -d '{
"settings": {"keyspace":"dm" },
       "mappings": {
           "mytable": { 
              "properties": {
                     "did": { "type": "text" },
                     "defectx": { "type": "float" },
                     "defecty": { "type": "float" },
                     "mdc": { "type": "text" }
                            }
        }
    }
}'

Not sure what is the mistake. Please help me to correct syntax for few columns but not all.

Sridhar
  • 21
  • 2
  • what is your elastic version ? please provide the elastic answer – Luc E Oct 08 '20 at 09:49
  • I am able to create index on few columns by passing cql_collection. "did": {"type": "text", "cql_collection":"singleton" } – Sridhar Oct 09 '20 at 01:38

1 Answers1

1

Your syntax is correct to create an index on few columns on an existing table. Check that the index does not already exists, and your keyspace and table names are correct.

vroyer
  • 31
  • 2
  • Verified them multiple times. All are correct and that index does not exists – Sridhar Oct 08 '20 at 07:57
  • 1
    I am able to create index on few columns by passing cql_collection. "did": {"type": "text", "cql_collection":"singleton" } – Sridhar Oct 09 '20 at 08:30