How to use ElasticSearch Custom Similarity provider classes?


(dark_shadow) #1

Hi,

I'm using the following two java files for overriding the Default
Similarity of ElasticSearch 0.90.3 but it's not working for me.

I have complied the two java files and added the corresponding class files
in my /lib/elasticsearc-0.90.3.jar file in the path
org/elasticsearch/index/similarity. Now, I'm trying to use those files in
my mapping like mentioned in:-

curl -XPOST 'http://host:port/tweeter/' -d '
{
"settings": {
"similarity": {
"index": {
"type": "org.elasticsearch.index.similarity.CustomSimilarityProvider"
},
"search": {
"type": "org.elasticsearch.index.similarity.CustomSimilarityProvider"
}
}
}
}'

But it's giving me following error:-

{"error":"IndexCreationException[[acqindex] failed to create index]; nested: ElasticSearchIllegalArgumentException[SimilarityProvider [my_similarity] must have an associated type]; ","status":400}

Can anyone please tell me how can I use these two files for overriding the default similarity ?

Thanks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/86099655-b887-42a8-92e4-92fa1f06ce48%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(dark_shadow) #2

I solved the error problem but still ElasticSearch is using its Default
Similariy. Can anyone tell me why is it not taking these new
CustomSimilarity files into consideration.
On Thursday, 16 January 2014 16:54:02 UTC+5:30, coder wrote:

Hi,

I'm using the following two java files for overriding the Default
Similarity of ElasticSearch 0.90.3 but it's not working for me.

https://github.com/awnuxkjy/es-custom-similarity-provider/tree/master/src/main/java/org/elasticsearch/index/similarity

I have complied the two java files and added the corresponding class files
in my /lib/elasticsearc-0.90.3.jar file in the path
org/elasticsearch/index/similarity. Now, I'm trying to use those files in
my mapping like mentioned in:-

curl -XPOST 'http://host:port/tweeter/' -d '
{
"settings": {
"similarity": {
"index": {
"type": "org.elasticsearch.index.similarity.CustomSimilarityProvider"
},
"search": {
"type": "org.elasticsearch.index.similarity.CustomSimilarityProvider"
}
}
}
}'

But it's giving me following error:-

{"error":"IndexCreationException[[acqindex] failed to create index]; nested: ElasticSearchIllegalArgumentException[SimilarityProvider [my_similarity] must have an associated type]; ","status":400}

Can anyone please tell me how can I use these two files for overriding the default similarity ?

Thanks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e082c7b9-9c7d-4b67-94e5-7194fcf2b114%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #3

I am assuming that you packaged the two Java files into a jar file and
deploy it to the $ES_PATH lib directory. Elasticsearch will pick up any jar
files in that directory.

Similarities are either set to be the default for all the indices via the
index.similarity.default.type configuration parameter [1] or it must be
associated directly with a field [2]. Use the example from the website,
your mapping would look something like:

{
"book" : {
"properties" : {
"title" : { "type" : "string", "similarity" : "index" }
}
}

As stated in the other thread, I believe the example provided in the plugin
is misleading since there is no individual index/search similarity. The
example creates two similarities types, "index" and "search", which use the
same similarity type.

[1]
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules-similarity.html
[2]
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html#_configuring_similarity_per_field

Cheers,

Ivan

On Thu, Jan 16, 2014 at 8:13 AM, coder mukulnitkkr@gmail.com wrote:

I solved the error problem but still ElasticSearch is using its Default
Similariy. Can anyone tell me why is it not taking these new
CustomSimilarity files into consideration.

On Thursday, 16 January 2014 16:54:02 UTC+5:30, coder wrote:

Hi,

I'm using the following two java files for overriding the Default
Similarity of ElasticSearch 0.90.3 but it's not working for me.

https://github.com/awnuxkjy/es-custom-similarity-provider/
tree/master/src/main/java/org/elasticsearch/index/similarity

I have complied the two java files and added the corresponding class
files in my /lib/elasticsearc-0.90.3.jar file in the path
org/elasticsearch/index/similarity. Now, I'm trying to use those files
in my mapping like mentioned in:-

curl -XPOST 'http://host:port/tweeter/' -d '
{
"settings": {
"similarity": {
"index": {
"type": "org.elasticsearch.index.similarity.CustomSimilarityProvider"
},
"search": {
"type": "org.elasticsearch.index.similarity.CustomSimilarityProvider"
}
}
}
}'

But it's giving me following error:-

{"error":"IndexCreationException[[acqindex] failed to create index]; nested: ElasticSearchIllegalArgumentException[SimilarityProvider [my_similarity] must have an associated type]; ","status":400}

Can anyone please tell me how can I use these two files for overriding the default similarity ?

Thanks

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/e082c7b9-9c7d-4b67-94e5-7194fcf2b114%40googlegroups.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQA037LOhM2ipiTVj39mm84M1YipVyjAJSFrnrYH9tYb8w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(dark_shadow) #4

Thanks a lot. It really solved my problem.

On Thu, Jan 16, 2014 at 11:22 PM, Ivan Brusic ivan@brusic.com wrote:

I am assuming that you packaged the two Java files into a jar file and
deploy it to the $ES_PATH lib directory. Elasticsearch will pick up any jar
files in that directory.

Similarities are either set to be the default for all the indices via the
index.similarity.default.type configuration parameter [1] or it must be
associated directly with a field [2]. Use the example from the website,
your mapping would look something like:

{
"book" : {
"properties" : {
"title" : { "type" : "string", "similarity" : "index" }
}
}

As stated in the other thread, I believe the example provided in the
plugin is misleading since there is no individual index/search similarity.
The example creates two similarities types, "index" and "search", which use
the same similarity type.

[1]
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules-similarity.html
[2]
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html#_configuring_similarity_per_field

Cheers,

Ivan

On Thu, Jan 16, 2014 at 8:13 AM, coder mukulnitkkr@gmail.com wrote:

I solved the error problem but still ElasticSearch is using its Default
Similariy. Can anyone tell me why is it not taking these new
CustomSimilarity files into consideration.

On Thursday, 16 January 2014 16:54:02 UTC+5:30, coder wrote:

Hi,

I'm using the following two java files for overriding the Default
Similarity of ElasticSearch 0.90.3 but it's not working for me.

https://github.com/awnuxkjy/es-custom-similarity-provider/
tree/master/src/main/java/org/elasticsearch/index/similarity

I have complied the two java files and added the corresponding class
files in my /lib/elasticsearc-0.90.3.jar file in the path
org/elasticsearch/index/similarity. Now, I'm trying to use those files
in my mapping like mentioned in:-

curl -XPOST 'http://host:port/tweeter/' -d '
{
"settings": {
"similarity": {
"index": {
"type": "org.elasticsearch.index.similarity.CustomSimilarityProvider"
},
"search": {
"type": "org.elasticsearch.index.similarity.CustomSimilarityProvider"
}
}
}
}'

But it's giving me following error:-

{"error":"IndexCreationException[[acqindex] failed to create index]; nested: ElasticSearchIllegalArgumentException[SimilarityProvider [my_similarity] must have an associated type]; ","status":400}

Can anyone please tell me how can I use these two files for overriding the default similarity ?

Thanks

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/e082c7b9-9c7d-4b67-94e5-7194fcf2b114%40googlegroups.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQA037LOhM2ipiTVj39mm84M1YipVyjAJSFrnrYH9tYb8w%40mail.gmail.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAAVTvp7USq9Z7j%2BcPVEmK3u%3DxUMfqkBMLx_-ZOuaJDy2YjnFGA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5