pjesudhas
pjesudhas

Reputation: 399

How to convert a SOLR mutivalued field into equivalent elastic search field

I'm working towards converting a solr schema file into elastic search equivalent.

I do not know how to convert a field that is multivalued in SOLR to elastic search equivalent

for example :

<field name="projectid" type="string" indexed="true" stored="true" multiValued="true" />

i looked at elasticsearch multi-field option but it looks more like a copyfield option.

Is all the fields in elasticsearch inherently multivalued.

please can you help on this

Upvotes: 2

Views: 552

Answers (1)

Dan Tuffery
Dan Tuffery

Reputation: 5924

The Elasticsearch equivalent is an array type. You just need to create an array in your JSON document and Elasticsearch will automatically detect it is an array. A simple example would be:

{
   "name":"arrayExample",
   "tags":["one", "two", "three" ]
}

If you were to do a search on the tags field with the search term one the above document would be returned.

Upvotes: 3

Related Questions