Dynamic data into Name Suggester


(Rahul Kalra) #1

Hi,
I am pretty new to Elastic Search, please help me find out how can I use
name_suggest on the data which I capture from ldap river.

I am trying to put the value of first name and last name fetched from
ldap river directly to name_suggest input so that these can be used in
suggestions.

Step 1. Created index with name_suggestor

curl -X PUT localhost:9200/ldapdata4 -d '
{
"mappings": {
"persons1" : {
"properties" : {
"dsId" : { "type" : "string" },
"firstName" : { "type" : "string" },
"lastName" : { "type" : "string" },
"name_suggest" : {
"type" : "completion"
}
}
}
}
}'

Checked the mapping created by running :
http://localhost:9200/ldapdata4/_mapping

{
"ldapdata4": {
"persons1": {
"properties": {
"dsId": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"name_suggest": {
"type": "completion",
"analyzer": "simple",
"payloads": false,
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_len": 50
},
}
}
}
}

*Step 2: *Restarted the elastic search instance and it fetched the data
from ldap.

curl -XPUT 'localhost:9200/_river/my_ldap_river1/_meta' -d '{
"type" : "ldap",
"ldap" : {
"host" : "lookup-uat.mycomp.com",
"userDn" : "",
"credentials" : "",
"baseDn" : "ou=people,o=mycomp",
"filter" : "(objectClass=person)",
"poll" : "86400s",
"scope" : "subtree",
"attributes" : [
"mycompDSID",
"mycompDSID",
"givenName",
"mycompLastName",
],
"fields" : [
"_id",
"dsId",
"firstName",
"lastName"
],

  • "name_suggest" : {*
  • "input" : ["firstName",*
    
  •     "lastName"*
    
  •      ]*
    
  • }*
    },
    "index" : {
    "index" : "ldapdata4",
    "type" : "persons1"
    }
    }'

Step 3: Checked the data inserted and found name_suggestor is not
populated

http://localhost:9200/ldapdata4/_search?pretty=true&q=:

{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 4,
"max_score" : 1.0,
"hits" : [ {
"_index" : "ldapdata4",
"_type" : "persons1",
"_id" : "143",
"_score" : 1.0, "_source" :
{"lastName":["babot","babbott"],"firstName":"Aarun"}
}, {
"_index" : "ldapdata4",
"_type" : "persons1",
"_id" : "93",
"_score" : 1.0, "_source" :
{"lastName":"sacskerson","firstName":"test"}
}

Please help me, how to put the dynamic data into name suggester.

--
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/d022942a-479b-43e9-83c0-8dbb9eeb8208%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Rahul Kalra) #2

On Thursday, January 16, 2014 5:29:01 PM UTC-8, Rahul Kalra wrote:

Hi,
I am pretty new to Elastic Search, please help me find out how can I use
name_suggest on the data which I capture from ldap river.

I am trying to put the value of first name and last name fetched from
ldap river directly to name_suggest input so that these can be used in
suggestions.

Step 1. Created index with name_suggestor

curl -X PUT localhost:9200/ldapdata4 -d '
{
"mappings": {
"persons1" : {
"properties" : {
"dsId" : { "type" : "string" },
"firstName" : { "type" : "string" },
"lastName" : { "type" : "string" },
"name_suggest" : {
"type" : "completion"
}
}
}
}
}'

Checked the mapping created by running :
http://localhost:9200/ldapdata4/_mapping

{
"ldapdata4": {
"persons1": {
"properties": {
"dsId": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"name_suggest": {
"type": "completion",
"analyzer": "simple",
"payloads": false,
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_len": 50
},
}
}
}
}

*Step 2: *Restarted the elastic search instance and it fetched the data
from ldap.


curl -XPUT 'localhost:9200/_river/my_ldap_river1/_meta' -d '{
"type" : "ldap",
"ldap" : {
"host" : "lookup-uat.mycomp.com",
"userDn" : "",
"credentials" : "",
"baseDn" : "ou=people,o=mycomp",
"filter" : "(objectClass=person)",
"poll" : "86400s",
"scope" : "subtree",
"attributes" : [
"mycompDSID",
"mycompDSID",
"givenName",
"mycompLastName",
],
"fields" : [
"_id",
"dsId",
"firstName",
"lastName"
],

  • "name_suggest" : {*
  • "input" : ["firstName",*
    
  •     "lastName"*
    
  •      ]*
    
  • }*
    },
    "index" : {
    "index" : "ldapdata4",
    "type" : "persons1"
    }
    }'

Step 3: Checked the data inserted and found name_suggestor is not
populated

http://localhost:9200/ldapdata4/_search?pretty=true&q=:

{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 4,
"max_score" : 1.0,
"hits" : [ {
"_index" : "ldapdata4",
"_type" : "persons1",
"_id" : "143",
"_score" : 1.0, "_source" :
{"lastName":["babot","babbott"],"firstName":"Aarun"}
}, {
"_index" : "ldapdata4",
"_type" : "persons1",
"_id" : "93",
"_score" : 1.0, "_source" :
{"lastName":"sacskerson","firstName":"test"}
}

Please help me, how to put the dynamic data into name suggester.

--
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/77987d5d-42c8-49fc-a93c-17bd2d2ca19e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Rahul Kalra) #3

Any Suggestions please ?

On Thursday, January 16, 2014 5:29:01 PM UTC-8, Rahul Kalra wrote:

Hi,
I am pretty new to Elastic Search, please help me find out how can I use
name_suggest on the data which I capture from ldap river.

I am trying to put the value of first name and last name fetched from
ldap river directly to name_suggest input so that these can be used in
suggestions.

Step 1. Created index with name_suggestor

curl -X PUT localhost:9200/ldapdata4 -d '
{
"mappings": {
"persons1" : {
"properties" : {
"dsId" : { "type" : "string" },
"firstName" : { "type" : "string" },
"lastName" : { "type" : "string" },
"name_suggest" : {
"type" : "completion"
}
}
}
}
}'

Checked the mapping created by running :
http://localhost:9200/ldapdata4/_mapping

{
"ldapdata4": {
"persons1": {
"properties": {
"dsId": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"name_suggest": {
"type": "completion",
"analyzer": "simple",
"payloads": false,
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_len": 50
},
}
}
}
}

*Step 2: *Restarted the elastic search instance and it fetched the data
from ldap.


curl -XPUT 'localhost:9200/_river/my_ldap_river1/_meta' -d '{
"type" : "ldap",
"ldap" : {
"host" : "lookup-uat.mycomp.com",
"userDn" : "",
"credentials" : "",
"baseDn" : "ou=people,o=mycomp",
"filter" : "(objectClass=person)",
"poll" : "86400s",
"scope" : "subtree",
"attributes" : [
"mycompDSID",
"mycompDSID",
"givenName",
"mycompLastName",
],
"fields" : [
"_id",
"dsId",
"firstName",
"lastName"
],

  • "name_suggest" : {*
  • "input" : ["firstName",*
    
  •     "lastName"*
    
  •      ]*
    
  • }*
    },
    "index" : {
    "index" : "ldapdata4",
    "type" : "persons1"
    }
    }'

Step 3: Checked the data inserted and found name_suggestor is not
populated

http://localhost:9200/ldapdata4/_search?pretty=true&q=:

{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 4,
"max_score" : 1.0,
"hits" : [ {
"_index" : "ldapdata4",
"_type" : "persons1",
"_id" : "143",
"_score" : 1.0, "_source" :
{"lastName":["babot","babbott"],"firstName":"Aarun"}
}, {
"_index" : "ldapdata4",
"_type" : "persons1",
"_id" : "93",
"_score" : 1.0, "_source" :
{"lastName":"sacskerson","firstName":"test"}
}

Please help me, how to put the dynamic data into name suggester.

--
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/d9f6f2b5-cf99-45ac-b9dd-8debfdef4fff%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4