Skip to content

Instantly share code, notes, and snippets.

@kierenj
Created October 9, 2012 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kierenj/3861975 to your computer and use it in GitHub Desktop.
Save kierenj/3861975 to your computer and use it in GitHub Desktop.
DELETE http://indriyax:9200/content/news
(gives 200 OK)
PUT http://indriyax:9200/content/news/_mapping
{
"news": {
"properties": {
"TextContent": {
"type": "string",
"index": "analyzed",
"store": "yes",
"analyzer": "htmlContentAnalyzer"
}
}
}
}
(gives 200 OK)
POST http://indriyax:9200/content/news
{
"ContentType": "news",
"WrapperClass": "CloudSite.CoreLogicApi.NewsContentItem, CloudSite.CoreLogicApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"Title": "A First news title here",
"CreatedByUsername": null,
"CreatedByDisplayName": null,
"CreatedDate": "0001-01-01T00:00:00",
"UpdatedDate": "0001-01-01T00:00:00",
"TextContent": "Today, something happened"
}
(gives 200 OK, my ID back, etc)
POST http://indriyax:9200/content/news
{
"ContentType": "news",
"WrapperClass": "CloudSite.CoreLogicApi.NewsContentItem, CloudSite.CoreLogicApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"Title": "B Second news title here",
"CreatedByUsername": null,
"CreatedByDisplayName": null,
"CreatedDate": "0001-01-01T00:00:00",
"UpdatedDate": "0001-01-01T00:00:00",
"TextContent": "Today, something <strong>really</strong> happened"
}
(same deal, 200 OK, get my ID back)
POST http://indriyax:9200/content/news/_search
{
"query": {
"match": {
"_all": "strong"
}
}
}
With the above, I get one result, the section item that was indexed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment