I have added the mappings for not analyzed option in elasticsearch, it is not working when i sort the results, here is my mapping shows when i use http://localhost:9200/_river/jdbc/_search
"mappings": {
"jdbc": {
"dynamic_templates": [
{ "notanalyzed": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "string",
"index": "not_analyzed"
}
}
}
]
}
}
But when i sort the reults it will take the results wrongly like
http://localhost:9200/jdbc/_search?pretty=true&sort=field:asc
{
field: "McDermott Will Amery",
},
sort: [
"amery"
]
}
But i need order the results from A-Z from the starting word in the field
UPDATE: River specification in meta
http://localhost:9200/_river/jdbc/_meta
{
"_index": "_river",
"_type": "jdbc",
"_id": "_meta",
"_version": 1,
"found": true,
"_source": {
"type": "jdbc",
"jdbc": {
"driver": "com.mysql.jdbc.Driver",
"url": "jdbc:mysql://localhost:3306/dbname",
"user": "user",
"password": "pass",
"sql": "SQL QUERY",
"poll": "24h",
"strategy": "simple",
"scale": 0,
"autocommit": true,
"bulk_size": 5000,
"max_bulk_requests": 30,
"bulk_flush_interval": "5s",
"fetchsize": 100,
"max_rows": 149669,
"max_retries": 3,
"max_retries_wait": "10s",
"locale": "in",
"digesting": true
},
"mappings": {
"jdbc": {
"dynamic_templates": [
{
"notanalyzed": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "string",
"index": "not_analyzed"
}
}
}
]
}
}
}
}
I think your configuration is not correct for what you want to do. Let's start over. First, let's delete your
_riverindex and we'll create it from scratch again:Now let's create it again but this time by using the correct configuration, i.e.:
jdbc.type_mappingfieldindexandtypewhere your data is going to be storedHere is how it would look like
Then when your SQL query runs, it will store data inside the
your_indexindex and use theyour_typemapping type.Finally, you can search your data with the following query:
UPDATE
You may also use the following mapping defining a multi-field. Then you'd be able to sort on the
not_analyzedfield and search on theanalyzedone:The query on the field named
fieldwould then be