# Moving from Solr to ES

**URL:** <https://discuss.elastic.co/t/moving-from-solr-to-es/8385>\
**Category:** Elasticsearch\
**Created:** [July 11, 2012, 3:36pm UTC](https://discuss.elastic.co/t/moving-from-solr-to-es/8385 "2012-07-11T15:36:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinicius\_Carvalho](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinicius_carvalho/32/770_2.png) [@Vinicius\_Carvalho](https://discuss.elastic.co/u/Vinicius_Carvalho)\
**Post date:** [July 11, 2012, 3:36pm UTC](https://discuss.elastic.co/t/moving-from-solr-to-es/8385/1 "2012-07-11T15:36:40Z")

</div>

Hi there! I'm testing solr and ES as the new backend search for our  
company. I really like ES flexibility, but I shall confess it's docs are  
kinda confusing.

I'm going through the mapping put api (I want to have more control over  
types, analyzers of my index) and I'm getting a bit confused.

For instance on solr we have a schema that we can define types for our  
documents I like that approach, so I can have defined search\_analyzer,  
index\_analyzer and filters per type. How does this work on ES?

I'm a bit confused on how to do this on ES. For instance, the mapping api  
has a \_type property that maps to indexed no/yes but mapping also have a  
type that could be string/number/date and so on. this is somehow confusion  
IMHO.

So what would be the best practice to set field level properties like  
indexing, storing, analyzer and so on?

Could someone provide some examples? Just warming up here, I'm sure I'll  
get up to speed soon.

Regards

---

<div class="post-metadata">

**Author:** ![Shairon\_Toledo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shairon_toledo/32/2490_2.png) [@Shairon\_Toledo](https://discuss.elastic.co/u/Shairon_Toledo)\
**Post date:** [July 11, 2012, 6:11pm UTC](https://discuss.elastic.co/t/moving-from-solr-to-es/8385/2 "2012-07-11T18:11:07Z")

</div>

Hi,

First of all, in solr you dont have index name(you can do it using core  
approach although), in ES you will define your fields and their types using  
mapping api or defining it in config/elasticsearch.yml.

Let me try to create a mapping similar to solr schema.xml, for this example  
I will create the index "shop1" and in the same time the mapping for type  
"products"( it'll appear as \_type in the response), comparing with solr  
"products" is the document itself, you can have many others types.  
Following the call.

curl -X PUT [http://localhost:9200/shop1](http://localhost:9200/shop1) -d '  
{  
"settings" : {  
"index" : {  
"analysis": {  
"analyzer": {  
"my\_analyzer": {  
"tokenizer": "standard",  
"filter": ["standard", "asciifolding","stop","lowercase"]  
}  
}  
},  
"mappings" : {  
"products": {  
"properties" : {  
"name" : {"type" : "string", "store" : "yes", "index" :  
"analyzed", "analyzer": "my\_analyzer"},  
"description" : {"type" : "string", "store" : "yes"},  
"sku" : {"type" : "string", "store" : "yes"}  
}  
}  
}  
}  
}  
}  
'  
As you may notice, there is a custom analyzer named as "my\_analyzer", it's  
similar to xpath:/schema/types/fieldType/analyzer in solr schema.xml. The  
diffence in ES is, the analyzer is defined globally instead of tied with  
document type, because you can use it in other types of document. After  
defining the analyzer, you can use it in any field, like "analyzer":  
"my\_analyzer", "search\_analyzer" and "index\_analyzer" in the query time,  
for example:

curl -XGET --silent "http://:9200$SERVER/shop1/products/\_search?pretty=true"  
-d '  
{  
"query":{  
"query\_string":{  
"fields": ["name","description"],  
"query": "laptop",  
"analyzer": "my\_analyzer"  
}  
}  
}  
'  
Or by url "analyzer=my\_analyzer".

On Wed, Jul 11, 2012 at 12:36 PM, Vinicius Carvalho \<  
[viniciusccarvalho@gmail.com](mailto:viniciusccarvalho@gmail.com)\> wrote:

> Hi there! I'm testing solr and ES as the new backend search for our  
> company. I really like ES flexibility, but I shall confess it's docs are  
> kinda confusing.
> 
> I'm going through the mapping put api (I want to have more control over  
> types, analyzers of my index) and I'm getting a bit confused.
> 
> For instance on solr we have a schema that we can define types for our  
> documents I like that approach, so I can have defined search\_analyzer,  
> index\_analyzer and filters per type. How does this work on ES?
> 
> I'm a bit confused on how to do this on ES. For instance, the mapping api  
> has a \_type property that maps to indexed no/yes but mapping also have a  
> type that could be string/number/date and so on. this is somehow confusion  
> IMHO.
> 
> So what would be the best practice to set field level properties like  
> indexing, storing, analyzer and so on?
> 
> Could someone provide some examples? Just warming up here, I'm sure I'll  
> get up to speed soon.
> 
> Regards

--

Shairon Toledo

> **[Microsoft Developer News | C++,C# & .NET Framework & More | CodeGuru](http://hashcode.me)**
>
> 您是否想要找关于幸运飞行艇 官方开奖历史记录 168飞艇全国统一开奖数据 还有幸运飞行艇官方开奖现场直播 幸运168飞艇全天精准稳定计划 这里都能一一提供。CodeGuru is where developers come to share ideas, articles, questions, answers, tips, tricks, comments, downloads, and more related to programming in areas including C++,...

---

<div class="post-metadata">

**Author:** ![Vinicius\_Carvalho](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinicius_carvalho/32/770_2.png) [@Vinicius\_Carvalho](https://discuss.elastic.co/u/Vinicius_Carvalho)\
**Post date:** [July 11, 2012, 7:48pm UTC](https://discuss.elastic.co/t/moving-from-solr-to-es/8385/3 "2012-07-11T19:48:52Z")

</div>

Thanks 🙂

On Wednesday, July 11, 2012 2:11:07 PM UTC-4, Shairon Toledo wrote:

> Hi,
> 
> First of all, in solr you dont have index name(you can do it using core  
> approach although), in ES you will define your fields and their types using  
> mapping api or defining it in config/elasticsearch.yml.
> 
> Let me try to create a mapping similar to solr schema.xml, for this  
> example I will create the index "shop1" and in the same time the mapping  
> for type "products"( it'll appear as \_type in the response), comparing with  
> solr "products" is the document itself, you can have many others types.  
> Following the call.
> 
> curl -X PUT [http://localhost:9200/shop1](http://localhost:9200/shop1) -d '  
> {  
> "settings" : {  
> "index" : {  
> "analysis": {  
> "analyzer": {  
> "my\_analyzer": {  
> "tokenizer": "standard",  
> "filter": ["standard", "asciifolding","stop","lowercase"]  
> }  
> }  
> },  
> "mappings" : {  
> "products": {  
> "properties" : {  
> "name" : {"type" : "string", "store" : "yes", "index" :  
> "analyzed", "analyzer": "my\_analyzer"},  
> "description" : {"type" : "string", "store" : "yes"},  
> "sku" : {"type" : "string", "store" : "yes"}  
> }  
> }  
> }  
> }  
> }  
> }  
> '  
> As you may notice, there is a custom analyzer named as "my\_analyzer", it's  
> similar to xpath:/schema/types/fieldType/analyzer in solr schema.xml. The  
> diffence in ES is, the analyzer is defined globally instead of tied with  
> document type, because you can use it in other types of document. After  
> defining the analyzer, you can use it in any field, like "analyzer":  
> "my\_analyzer", "search\_analyzer" and "index\_analyzer" in the query time,  
> for example:
> 
> curl -XGET --silent  
> "http://:9200$SERVER/shop1/products/\_search?pretty=true" -d '  
> {  
> "query":{  
> "query\_string":{  
> "fields": ["name","description"],  
> "query": "laptop",  
> "analyzer": "my\_analyzer"  
> }  
> }  
> }  
> '  
> Or by url "analyzer=my\_analyzer".
> 
> On Wed, Jul 11, 2012 at 12:36 PM, Vinicius Carvalho \<  
> [viniciusccarvalho@gmail.com](mailto:viniciusccarvalho@gmail.com)\> wrote:
> 
> > Hi there! I'm testing solr and ES as the new backend search for our  
> > company. I really like ES flexibility, but I shall confess it's docs are  
> > kinda confusing.
> > 
> > I'm going through the mapping put api (I want to have more control over  
> > types, analyzers of my index) and I'm getting a bit confused.
> > 
> > For instance on solr we have a schema that we can define types for our  
> > documents I like that approach, so I can have defined search\_analyzer,  
> > index\_analyzer and filters per type. How does this work on ES?
> > 
> > I'm a bit confused on how to do this on ES. For instance, the mapping api  
> > has a \_type property that maps to indexed no/yes but mapping also have a  
> > type that could be string/number/date and so on. this is somehow confusion  
> > IMHO.
> > 
> > So what would be the best practice to set field level properties like  
> > indexing, storing, analyzer and so on?
> > 
> > Could someone provide some examples? Just warming up here, I'm sure I'll  
> > get up to speed soon.
> > 
> > Regards
> 
> --
> 
> Shairon Toledo  
> [http://hashcode.me](http://hashcode.me)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:20am UTC](https://discuss.elastic.co/t/moving-from-solr-to-es/8385/4 "2017-07-06T03:20:34Z")

</div>


